From: Jason Green To: Laurynas Biveinis Cc: Eli Zaretskii , djgpp-workers AT delorie DOT com Subject: Re: Symify fixes Date: Thu, 31 Aug 2000 19:12:57 +0100 Message-ID: <4k7tqskuugpt8r78ls4hnt2cfhuggjdtu3@4ax.com> References: <226lqssqgqp6i9nk82rvrqhl9aaia029e9 AT 4ax DOT com> <7458-Mon28Aug2000203504+0300-eliz AT is DOT elta DOT co DOT il> <8011-Mon28Aug2000234727+0300-eliz AT is DOT elta DOT co DOT il> <39AD1BF3 DOT 139CB5DB AT softhome DOT net> <9003-Wed30Aug2000195653+0300-eliz AT is DOT elta DOT co DOT il> <3b5rqskv9adg5lcc3p4nhg2doib859r3n8 AT 4ax DOT com> <39AE0E92 DOT C8E0A73B AT softhome DOT net> In-Reply-To: <39AE0E92.C8E0A73B@softhome.net> X-Mailer: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id OAA17457 Reply-To: djgpp-workers AT delorie DOT com On Thu, 31 Aug 2000 09:51:46 +0200, you wrote: > > It's not sufficient to simply test errno to see if an error occured, > > because it only has meaningful value if tested after a system call > > that has returned some failure indication. > > And if I have not missing anything, this is the only way bail() will be > used - right after failed syscall. bail() will be called due to fseek outside file boundary, or fread past eof; these are not failed system calls. If you know these functions will always set errno=0 (no POSIX function is required to do that) then your code would be safe. In that case, the only change I would make would be to rename it bail_syserr(), or something like that, to be clearer about its purpose, and to add some comment warning that it probably won't work outside of djgpp. > If you don't change your mind about errno, then I'll commit current bail() > version. It's code of yours, after all. Sure it's my code. I have no problem, though, if you want to improve it with inside knowledge of how djgpp implements errno. Perhaps you could mail the patch first, I'll re-run the tests I did, then you can commit it. > > There is some generic > > code by Richard Stevens which takes printf style arguments to provide > > better context to the error reporting, I can dig this out if you like. > > Yes, I'm curious. There are 5 functions for putting error messages to stderr: err_ret(): Nonfatal error related to a system call. Print a message and return. err_sys(): Fatal error related to a system call. Print a message and terminate. err_dump(): Fatal error related to a system call. Print a message, dump core, and terminate. err_msg(): Nonfatal error unrelated to a system call. Print a message and return. err_quit(): Fatal error unrelated to a system call. Print a message and terminate. The code is in apue/advio/ourhdr.h and apue/lib.44/error.c, from the archive http://www.kohala.com/start/apue.tar.Z No changes are required to compile with DJGPP, just #include "ourhdr.h" and link with error.c. -- [please cc all replies, thanks]