Re: [PATCH] xgethostbyname using realloc()

2009-08-28 Thread Jim Meyering
Robert Millan wrote: > This makes it easier to import xgethostname.c into an external program. What's the motivation? removing dependencies? > 2009-08-29 Robert Millan > > * lib/xgethostname.c: Remove `"xalloc.h"'. > (xgethostname): Use realloc() instead of x2realloc(). > ... > -

[PATCH] xgethostbyname using realloc()

2009-08-28 Thread Robert Millan
This makes it easier to import xgethostname.c into an external program. 2009-08-29 Robert Millan * lib/xgethostname.c: Remove `"xalloc.h"'. (xgethostname): Use realloc() instead of x2realloc(). -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will dec

[PATCH] add "extern \"C\"" blurb to xgethostname.h

2009-08-28 Thread Robert Millan
This makes xgethostname.h usable on C++. 2009-08-29 Robert Millan * lib/xgethostname.h [__cplusplus] (xgethostname): Enclose declaration within `extern "C"'. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access

Re: need opendir_safer, dirent--.h

2009-08-28 Thread Eric Blake
> I think we need to implement opendir_safer, alongside all the other > *_safer modules. Otherwise, opendir can end up placing an open directory > fd in one of the standard slots, and end up interfering with the intent of > all the other *_safer wrappers. And here's at least one use case where i

need opendir_safer, dirent--.h

2009-08-28 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I think we need to implement opendir_safer, alongside all the other *_safer modules. Otherwise, opendir can end up placing an open directory fd in one of the standard slots, and end up interfering with the intent of all the other *_safer wrappers. -

Re: [PATCH] open: introduce O_NOSTD

2009-08-28 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Florian Weimer on 8/28/2009 6:52 AM: > * Eric Blake: > >> Your version fails to clear the cloexec bit of the final fd if the >> original caller didn't request O_CLOEXEC. > > Okay, but you can fix that in a race-free manner (but I thought

Re: [PATCH] open: introduce O_NOSTD

2009-08-28 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Florian Weimer on 8/28/2009 6:52 AM: >> If the caller requested O_CLOEXEC, then your version takes 3, 5, or >> 7 syscalls depending on how many std fds were closed, while my >> version takes 3 syscalls regardless of how many std fds were c

Re: [PATCH] open: introduce O_NOSTD

2009-08-28 Thread Florian Weimer
* Eric Blake: > Your version fails to clear the cloexec bit of the final fd if the > original caller didn't request O_CLOEXEC. Okay, but you can fix that in a race-free manner (but I thought that this was implied by open_safer). > If the caller requested O_CLOEXEC, then your version takes 3, 5,

Re: [PATCH] open: introduce O_NOSTD

2009-08-28 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Florian Weimer on 8/27/2009 8:35 AM: > * Eric Blake: > >> int open_safer (const char *name, int flags, int mode) >> { >> int fd = open (name, flags | O_CLOEXEC, mode); >> if (0 <= fd && fd <= 2) >> { >> int dup = fcntl (fd,

Re: [PATCH] open: introduce O_NOSTD

2009-08-28 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Ulrich Drepper on 8/27/2009 8:22 AM: >> I hope that my example shows why doing it in the kernel is desirable - >> there is no safe way to keep the pre-O_CLOEXEC efficiency using just the >> library, but there IS a way to do it with kernel