public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "michael dot kerrisk at gmx dot net" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/1952] time() returns incorrect value when given bad address
Date: Wed, 30 Nov 2005 16:31:00 -0000	[thread overview]
Message-ID: <20051130163125.23099.qmail@sourceware.org> (raw)
In-Reply-To: <20051130155046.1952.michael.kerrisk@gmx.net>


------- Additional Comments From michael dot kerrisk at gmx dot net  2005-11-30 16:31 -------
Subject: Re:  time() returns incorrect value when given bad address

> time is marked with E, i.e. not returning error (which I'd say matches
> POSIX which doesn't define any errors for time).  By passing an invalid
> address to the function you reach undefined behaviour territory and all
> answers are fine in that case.
 
Hi Jakub

Thanks for your quick reply.

POSIX does not define any errno values for time(), but nevertheless 
says:

    Upon successful completion, time( ) shall return the value of 
    time. Otherwise, (time_t)&#8722;1 shall be returned.
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In my book, that means that time() should reasonably return -1
here.

The POSIX.1 "No errors are defined" means

    that error values returned by a function or stored into a 
    variable accessed through the symbol errno, if any, depend 
    on the implementation.

This does not (in my reading) mean that no error indication 
(i.e., -1 in this case) should be returned.

Note also that glibc is thwarting the underlying system call, which
does actually return -1 for this case (as my program demonstrates).

Cheers,

Michael



-- 


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.


  parent reply	other threads:[~2005-11-30 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-30 15:50 [Bug libc/1952] New: " 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 [this message]
2005-12-20  7:50 ` drepper at redhat dot com
2005-12-20  8:18 ` michael dot kerrisk at gmx dot net

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051130163125.23099.qmail@sourceware.org \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).