[EMAIL PROTECTED] wrote:
As a related note glibc has some questionable protections, like
free(NULL)
which it simply ignores resulting in bugs remaining hidden. GNU ls
does a
free(NULL) somewhere which we discovered while demoing truss on linux
processes in BrandZ. It is also visible
Moinak Ghosh <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > [...]
> >> Strictly conformant to the above would therefore be:
> >>
> >> #definedirfd(dp) ((dp) ? (dp)->dd_fd : -1)
> >>
> >
> > No. Nothing to do with strictly conformant; while it is possible
> > to have a DI
Joerg Schilling wrote:
>Ian Collins <[EMAIL PROTECTED]> wrote:
>
>
>
>>>Solaris libc, unfortunately, also allows free(foo); free(foo);
>>>
>>>
>>>
>>>
>>>
>>Legal undefined behaviour :)
>>
>>
>
>Calling free(foo); free(foo); is not legal and may result in anything,
>including
>pink s
Ian Collins <[EMAIL PROTECTED]> wrote:
> >Solaris libc, unfortunately, also allows free(foo); free(foo);
> >
> >
> >
> Legal undefined behaviour :)
Calling free(foo); free(foo); is not legal and may result in anything, including
pink smoke on top of your screen.
free(foo); free(foo); however i
[EMAIL PROTECTED] wrote:
>
>
> > As a related note glibc has some questionable protections, like
> >free(NULL)
> > which it simply ignores resulting in bugs remaining hidden. GNU ls
> >does a
> > free(NULL) somewhere which we discovered while demoing truss on linux
> > processes in Brand
[EMAIL PROTECTED] wrote:
>
>
>> As a related note glibc has some questionable protections, like
>>free(NULL)
>> which it simply ignores resulting in bugs remaining hidden. GNU ls
>>does a
>> free(NULL) somewhere which we discovered while demoing truss on linux
>> processes in BrandZ. It is
> As a related note glibc has some questionable protections, like
>free(NULL)
> which it simply ignores resulting in bugs remaining hidden. GNU ls
>does a
> free(NULL) somewhere which we discovered while demoing truss on linux
> processes in BrandZ. It is also visible when you use ltrac
Moinak Ghosh wrote:
> [EMAIL PROTECTED] wrote:
>
>> [...]
>>
>>> Strictly conformant to the above would therefore be:
>>>
>>> #definedirfd(dp)((dp) ? (dp)->dd_fd : -1)
>>>
>>
>>
>> No. Nothing to do with strictly conformant; while it is possible
>> to have a DIR * which is NULL, usin
[EMAIL PROTECTED] wrote:
[...]
Strictly conformant to the above would therefore be:
#define dirfd(dp) ((dp) ? (dp)->dd_fd : -1)
No. Nothing to do with strictly conformant; while it is possible
to have a DIR * which is NULL, using it immediately gets you undefined
behaviour.
IMHO,
Stefan Teleman <[EMAIL PROTECTED]> wrote:
> On Thursday 22 March 2007 15:42, [EMAIL PROTECTED] wrote:
> > >> getc(NULL) also blows up; what is your point?
> > >
> > >My point is that it should not SEGV on NULL pointer. It should
> > >return -1 and set EBADF.
> >
> > You are wrong; the standard dis
>On Thursday 22 March 2007 15:42, [EMAIL PROTECTED] wrote:
>> >> getc(NULL) also blows up; what is your point?
>> >
>> >My point is that it should not SEGV on NULL pointer. It should
>> >return -1 and set EBADF.
>>
>> You are wrong; the standard disagrees with you.
>
>7.19.7.5.3:
>
>The [getc] fun
Stefan Teleman writes:
> On Thursday 22 March 2007 15:42, [EMAIL PROTECTED] wrote:
> > >> getc(NULL) also blows up; what is your point?
> > >
> > >My point is that it should not SEGV on NULL pointer. It should
> > >return -1 and set EBADF.
> >
> > You are wrong; the standard disagrees with you.
>
On Thursday 22 March 2007 15:42, [EMAIL PROTECTED] wrote:
> >> getc(NULL) also blows up; what is your point?
> >
> >My point is that it should not SEGV on NULL pointer. It should
> >return -1 and set EBADF.
>
> You are wrong; the standard disagrees with you.
7.19.7.5.3:
The [getc] function return
>> getc(NULL) also blows up; what is your point?
>
>My point is that it should not SEGV on NULL pointer. It should
>return -1 and set EBADF.
You are wrong; the standard disagrees with you.
What point is there to have obviously broken code do plausible
things?
FILE *fp = fopen("no-such
On Thursday 22 March 2007 15:03, [EMAIL PROTECTED] wrote:
> >On Thursday 22 March 2007 10:21, Joerg Schilling wrote:
> >> But BTW: dirfd() would be just:
> >>
> >> #define dirfd(dp) (dp)->dd_fd
> >
> >This works really well when (dp) is NULL.
>
> Yes, is will SEGV; is that an issue?
Yes. It can r
>None of them mentions whether DIR can be NULL.
NULL is not a valid DIR * therefor you invoke undefined behaviour;
then anything goes.
>One could argue 'returns -1 on error' would mean they should return -1
>then - but then, neither of the above specify what errno would have to be
>set to.
No
>On Thursday 22 March 2007 10:21, Joerg Schilling wrote:
>
>> But BTW: dirfd() would be just:
>>
>> #define dirfd(dp)(dp)->dd_fd
>
>This works really well when (dp) is NULL.
Yes, is will SEGV; is that an issue?
getc(NULL) also blows up; what is your point?
If you right buggy code without er
Stefan Teleman writes:
> On Thursday 22 March 2007 10:21, Joerg Schilling wrote:
>
> > But BTW: dirfd() would be just:
> >
> > #define dirfd(dp) (dp)->dd_fd
>
> This works really well when (dp) is NULL.
Ignoring the NULL question for a moment, think it would be quite wrong
to implement this as
Stefan Teleman <[EMAIL PROTECTED]> wrote:
> /* testnulldir.c */
>
> #include
> #include
> #include
>
> #define dirfd(dp)(dp)->dd_fd
> static const char* dirname = "/this/baby/does/not/exist";
>
> int
> main(int argc, char* argv[])
> {
> DIR* dir;
> int fd;
>
> fd = dirfd(opendir
Frank Hofmann <[EMAIL PROTECTED]> wrote:
> On Thu, 22 Mar 2007, Stefan Teleman wrote:
>
> > On Thursday 22 March 2007 10:21, Joerg Schilling wrote:
> >
> >> But BTW: dirfd() would be just:
> >>
> >> #define dirfd(dp) (dp)->dd_fd
> >
> > This works really well when (dp) is NULL.
> >
> > --Stefan
>
On Thursday 22 March 2007 12:29, Joerg Schilling wrote:
> Stefan Teleman <[EMAIL PROTECTED]> wrote:
> > On Thursday 22 March 2007 10:21, Joerg Schilling wrote:
> > > But BTW: dirfd() would be just:
> > >
> > > #define dirfd(dp) (dp)->dd_fd
> >
> > This works really well when (dp) is NULL.
>
> ???
>
On Thu, 22 Mar 2007, Stefan Teleman wrote:
On Thursday 22 March 2007 10:21, Joerg Schilling wrote:
But BTW: dirfd() would be just:
#define dirfd(dp) (dp)->dd_fd
This works really well when (dp) is NULL.
--Stefan
Found those:
http://www.die.net/doc/linux/man/man3/dirfd.3.html
http:
Stefan Teleman <[EMAIL PROTECTED]> wrote:
> On Thursday 22 March 2007 10:21, Joerg Schilling wrote:
>
> > But BTW: dirfd() would be just:
> >
> > #define dirfd(dp) (dp)->dd_fd
>
> This works really well when (dp) is NULL.
???
Garbage in -> garbage out.
Do not expect to get useful results in c
On Thursday 22 March 2007 10:21, Joerg Schilling wrote:
> But BTW: dirfd() would be just:
>
> #define dirfd(dp) (dp)->dd_fd
This works really well when (dp) is NULL.
--Stefan
--
Stefan Teleman 'Nobody Expects the Spanish Inquisition'
KDE e.V.
Jonathan Wheeler <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> Though I don't personally have enough knowledge about the subject to really
> make a very good argument here, it's been suggested by steleman (from
> #opensolaris), that I start a thread on OpenSolaris-discuss about this
> function, and
A function like dirfd() is probably needed for completeness and
compatibility, though I wonder what people are using it for
Casper
___
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org
Hi All,
Though I don't personally have enough knowledge about the subject to really
make a very good argument here, it's been suggested by steleman (from
#opensolaris), that I start a thread on OpenSolaris-discuss about this
function, and the possibility of including it within upcoming builds
27 matches
Mail list logo