Re: [hackers] [dwm][PATCH] Fix bug in die()

2024-10-27 Thread Raymond Cole
On 24/10/27 06:27PM, Hiltjo Posthuma wrote: > Thanks for the patch. I agree and the common pattern is even, at the top of > the function: > > int saved_errno = errno; > > Then use (or restore) errno. > I notice dmenu, dwm, libsl, sbase, etc have this bug. > Sorry, I didn't notice vprintf

Re: [hackers] [dwm][PATCH] Fix bug in die()

2024-10-27 Thread NRK
On Sun, Oct 27, 2024 at 07:14:00PM GMT, Storkman wrote: > Are there implementations that clobber errno on success? Both ISO C and POSIX allows library functions to change errno even if the call succeeds. Whether any implementation actually does it or not, I'm not sure. - NRK

Re: [hackers] [dwm][PATCH] Fix bug in die()

2024-10-27 Thread Storkman
On Sun, Oct 27, 2024 at 06:27:13PM +0100, Hiltjo Posthuma wrote: > On Sun, Oct 27, 2024 at 03:05:37PM +, Raymond Cole wrote: > > fputc() might set errno and thus affect perror(). > > --- > > util.c | 10 -- > > 1 file changed, 4 insertions(+), 6 deletions(-) > > > > diff --git a/util.

Re: [hackers] [dwm][PATCH] Fix bug in die()

2024-10-27 Thread Hiltjo Posthuma
On Sun, Oct 27, 2024 at 03:05:37PM +, Raymond Cole wrote: > fputc() might set errno and thus affect perror(). > --- > util.c | 10 -- > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/util.c b/util.c > index 96b82c9..a289160 100644 > --- a/util.c > +++ b/util.c > @@ -

[hackers] [dwm][PATCH] Fix bug in die()

2024-10-27 Thread Raymond Cole
fputc() might set errno and thus affect perror(). --- util.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/util.c b/util.c index 96b82c9..a289160 100644 --- a/util.c +++ b/util.c @@ -1,4 +1,5 @@ /* See LICENSE file for copyright and license details. */ +#include