svn commit: r215310 - head/lib/libc/gen

Garrett Cooper gcooper at FreeBSD.org
Sun Nov 14 23:15:30 UTC 2010


On Sun, Nov 14, 2010 at 3:06 PM, Gavin Atkinson <gavin at freebsd.org> wrote:
> On Sun, 14 Nov 2010, Ed Schouten wrote:
>> Author: ed
>> Date: Sun Nov 14 18:42:39 2010
>> New Revision: 215310
>> URL: http://svn.freebsd.org/changeset/base/215310
>>
>> Log:
>>   Always set errno to a sane value when pututxline(3) fails.
>>
>>   For example, it will now return ESRCH when trying to replace a
>>   nonexistent entry with DEAD_PROCESS.
>>
>> Modified:
>>   head/lib/libc/gen/pututxline.c
>>
>> Modified: head/lib/libc/gen/pututxline.c
>> ==============================================================================
>> --- head/lib/libc/gen/pututxline.c    Sun Nov 14 18:24:12 2010        (r215309)
>> +++ head/lib/libc/gen/pututxline.c    Sun Nov 14 18:42:39 2010        (r215310)
>> @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
>>  #include <sys/endian.h>
>>  #include <sys/stat.h>
>>  #include <sys/uio.h>
>> +#include <errno.h>
>>  #include <fcntl.h>
>>  #include <stdio.h>
>>  #include <string.h>
>> @@ -53,6 +54,7 @@ futx_open(const char *file)
>>       /* Safety check: never use broken files. */
>>       if (_fstat(fd, &sb) != -1 && sb.st_size % sizeof(struct futx) != 0) {
>>               _close(fd);
>> +             errno = EINVAL;
>>               return (NULL);
>>       }
>
> setutxdb(3) returns EFTYPE here, for the same error.  Should this be the
> same?
>
>>
>> @@ -142,6 +144,7 @@ utx_active_remove(struct futx *fu)
>>       }
>>
>>       fclose(fp);
>> +     errno = ESRCH;
>>       return (1);
>>  }
>
> These possible errors should probably also now be documented in
> pututxline(3).

    I submitted another patch earlier to Ed that does this and a bit
more (attached). He was going to take a look at the patch and get back
to me (and I CCed Bruce Evans for additional comments), but please
feel free to chime in :).
Thanks,
-Garrett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: utx-changes-2.patch
Type: text/x-patch
Size: 9016 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20101114/80ac0ac0/utx-changes-2-0001.bin


More information about the svn-src-head mailing list