Subject: Re: perror From: Tim Van Holder To: djgpp-workers AT delorie DOT com Cc: JT Williams In-Reply-To: <20030227150458.GA3476@kendall.sfbr.org> References: <20030227150458 DOT GA3476 AT kendall DOT sfbr DOT org> Content-Type: text/plain; charset=UTF-8 Organization: Message-Id: <1046360051.30750.3.camel@leeloo> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 27 Feb 2003 16:34:11 +0100 Content-Transfer-Encoding: 8bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 2003-02-27 at 16:04, JT Williams wrote: > blank, followed by the message and a NEWLINE character. If > s is a null pointer or points to a null string, the colon is > not printed. > > - fprintf(stderr, "%s: %s\n", s, strerror(errno)); > + if (s) Then this should probably be 'if (s && *s)'. > + fprintf(stderr, "%s: %s\n", s, strerror(errno)); > + else > + fprintf(stderr, "%s\n", s, strerror(errno)); > } As for the blank, the Linux man page isn't very clear either: First (if s is not NULL and *s is not NUL) the argument string s is printed, followed by a colon and a blank. Then the message and a new‐line. This is decidedly unclear about the fate of the colon and blank if s is null or empty. -- Tim Van Holder