This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/5209] return from times() system call treated as errno
- From: "jakub at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 10 Apr 2008 07:16:14 -0000
- Subject: [Bug libc/5209] return from times() system call treated as errno
- References: <20071022211548.5209.Alan.Wood@vectek.co.nz>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From jakub at redhat dot com 2008-04-10 07:16 -------
Well, there is a problem with this, because the syscall returning -EFAULT
may mean two things: 1) clock_t equal to -EFAULT 2) invalid address passed to it.
E.g. times ((struct tms *) -4UL) should return -1 and set errno to EFAULT, but
after this change it doesn't. This can be handled by reading and writing back
the tms structure if -EFAULT was returned - if the address was invalid, it will
segfault, which is ok, if it wasn't, it will return the correct value.
Also, when the syscall returns -1, meaning clock_t right before 0, POSIX says
that errno should be returned, but the kernel didn't return an error case.
Perhaps we should return 0 instead?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
http://sourceware.org/bugzilla/show_bug.cgi?id=5209
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.