X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:message-id:references :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=AWqLXbtlriDwnYssMTCwH53Q54adbs52VwCJeooCrrQi4ZZpU51n2 oMnlkogEWmglycUmtDJcjKpxfPfLLwtb3R/vPZJnB2+HUzyPZLYwfyNEDsllWxRx wd805fqDewAoMfxjVo19E9zokeT0bc/zf7o3He/gXHRzB/D/CcHQUE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:message-id:references :mime-version:content-type:content-transfer-encoding; s=default; bh=DW88nCep9zgrxvHdU61e7wORdnM=; b=G7AGYYbrG0fCqG4AwcDe14KdOUf1 7Vv7z2nGDdjKNZCh26Kpk8VxmKMIkDvdo0aGGmWiVPpY6+uTVp/1SpYbcb/ivM7n qktUEgCdAj44pIIRkk0xa3GZdh26d5MExjE3zqY+/gGWngeTvivHoTWEi9ImiGpZ wilmiduowToHt9E= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:D*ca, H*MI:sk:RnRQ AT ma, H*MI:sk:CALiPeu, H*MI:CALiPeun3v X-HELO: plane.gmane.org To: cygwin AT cygwin DOT com From: Brian Inglis Subject: Re: Issues in utmp/utmpx headers Date: Mon, 4 Jan 2016 18:30:27 +0000 (UTC) Lines: 40 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes > On 29 December 2015 at 13:16, Brian Inglis > systematicsw.ab.ca> wrote: >> The utmpname implementation in newlib-cygwin/winsup/cygwin/syscalls.cc >> could probably be improved to: avoid a memory leak; return -1 if >> strdup fails, zero otherwise; default the path if a null pointer or string >> argument is passed. >> That would also fix utmpxname which is an alias. >> Such a change would have little likely impact on downstream apps, but could >> produce warnings about ignoring return values. >> Unfortunately there appears to be no standard defined names to access the >> default file name although GNU and Cygwin provide UTMP_FILE and UTMPX_FILE; >> GNU also provide UTMP_FILENAME and UTMPX_FILENAME. >> _PATH_UTMP and _PATH_UTMPX are implementation reserved names which may or >> may not be provided, though adding the latter in paths.h would be trivial. >> As the developers say, patches always welcome. David Lee gmail.com> writes: > Sorry I am totally unfamiliar with Cygwin internals, here are some > related questions: > 1. how does one test a code path that involves a failed syscall > (strdup() in this case, but can be others) in cygwin dll? Unlikely to happen, but could test in your code for errno == ENOMEM, as errno should never be cleared, but relies on appropriate tests. > 2. If the call to strdup() fails, I want to debug_print() the errno > value set by strdup(). Do I have to save errno before debug_print() > that and restore afterwards? Save only and use your saved copy. > 3. Does the instruction from 6.21 in > https://cygwin.com/faq/faq.html#faq.programming.building-cygwin > generates a debugging dll (i.e. contains debug symbols usable by > gdb)? If not, what modifications are needed to create one? https://cygwin.com/faq/faq.html#faq.programming.debugging-cygwin FAQ 6.22 explains to install cygwin-debuginfo for released dll and that 6.21 generates debug info for custom dll. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple