public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/1952] New: time() returns incorrect value when given bad address
@ 2005-11-30 15:50 michael dot kerrisk at gmx dot net
  2005-11-30 16:18 ` [Bug libc/1952] " jakub at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: michael dot kerrisk at gmx dot net @ 2005-11-30 15:50 UTC (permalink / raw)
  To: glibc-bugs

When the program below is run on Linux/x86, the following output 
is produced:

After time():            t=-14, errno=0
After syscall(SYS_time): t=-1, errno=14

In the first line, the reported return value from time() should be 
-1, with errno set to EFAULT (14).  Instead, the call returns -14.

Could this be a configuration problem in 
sysdeps/unix/sysv/linux/i386/syscalls.list?

Cheers,

Michael

==========

#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <time.h>

#define VAL 1000

int main() {
    time_t t;

    t = time((time_t *)VAL);
    printf("After time():            t=%ld, errno=%d\n", (long) t, errno);
    t = syscall(SYS_time, (time_t *)VAL);
    printf("After syscall(SYS_time): t=%ld, errno=%d\n", (long) t, errno);
    return 0;
}

-- 
           Summary: time() returns incorrect value when given bad address
           Product: glibc
           Version: 2.3.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: michael dot kerrisk at gmx dot net
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=1952

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-12-20  8:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-30 15:50 [Bug libc/1952] New: time() returns incorrect value when given bad address michael dot kerrisk at gmx dot net
2005-11-30 16:18 ` [Bug libc/1952] " jakub at redhat dot com
2005-11-30 16:31 ` michael dot kerrisk at gmx dot net
2005-12-20  7:50 ` drepper at redhat dot com
2005-12-20  8:18 ` michael dot kerrisk at gmx dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).