This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2.1 1/2][BZ #16274] Fix shm_open.


On Mon, Dec 02, 2013 at 06:42:09PM -0500, Carlos O'Donell wrote:
> On 12/02/2013 06:04 PM, OndÅej BÃlka wrote:
> > On Fri, Nov 29, 2013 at 02:48:31PM -0500, Carlos O'Donell wrote:
> >>> +      if (errno != ENOSYS)
> >>
> >> Same question here, shouldn't this be "errno == ENOSYS"?
> >>
> >>> +        error (EXIT_FAILURE, 0, "failed to open shared memory object: shm_open");
> >>> +
> >>
> >> Suggest: "Failed to open shared memory object: shm_open unimplemented. Test skipped." wrapped appropriately.
> >>
> >>>        perror ("failed to create a shared memory object: shm_open");
> >>>        return 0;
> >>
> >> Shouldn't this be `return -1;' ?
> >>
> >> We want to exit with 0 if the error was ENOSYS otherwise -1?
> >>
> >> Maybe it's just Friday and I'm confused though...
> >>
> > It was double negation, which is correct but bit confusing.
> > 
> > Here is new version, a do_open function uses a existing shared object so
> > I simply inlined it with appropriate error. 
> 
> Thanks.
>  
> > -      /* We don't regard this as a bug.  Simply don't run the test.  It could
> > -	 means there is no such implementation or the object is already in
> > -	 use in which case we don't want to disturb.  */
> > -      perror ("failed to create a shared memory object: shm_open");
> > -      return 0;
> > +      /* If shm_open is unimplemented we skip the test.  */
> > +      if (errno == ENOSYS)
> > +        {
> > +	  perror ("shm_open unimplemented.  Test skipped.");
> > +          return 0;
> > +        }
> > +      else
> > +        error (EXIT_FAILURE, 0, "failed to create shared memory object: shm_open");
> 
> Shouldn't this be s/0/-1/g? It's a real failure?

It is failure as we passed EXIT_FAILURE to status, arguments to error are:

 error (int status, int errnum, const char *format, ...)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]