public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: Bug in TIME function
Date: Thu, 12 Sep 2019 23:03:00 -0000	[thread overview]
Message-ID: <78512bbe-b912-9bf5-d6cf-9da5b982c955@SystematicSw.ab.ca> (raw)
In-Reply-To: <009d01d56994$a8065040$f812f0c0$@twcny.rr.com>

On 2019-09-12 12:05, tlake@twcny.rr.com wrote:
> The code below returns -1. It shouldn't.
> #include <sys/times.h>
> #include <stdio.h>
> int main(int argc, char *argv[])
> {
>   printf("return value %ld\n", (long)times((struct tms*)0));
>   return 0;
> }

It should.
The times(3) function requires a pointer to object storage to return the results
which are its function.
An invalid pointer to object storage is an error, requiring -1 be returned and
errno set.
You should also print errno and strerror(errno).

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  parent reply	other threads:[~2019-09-12 18:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12 18:16 tlake
2019-09-12 18:44 ` Kaz Kylheku
2019-09-13  0:50   ` Kaz Kylheku
2019-09-12 23:03 ` Brian Inglis [this message]
2019-09-13 11:37   ` tlake
2019-09-13 19:59     ` Wayne Davison
2019-09-13 23:05       ` Kaz Kylheku
2019-09-18  0:16         ` Brian Inglis
2019-09-16  7:30 ` Achim Gratz

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=78512bbe-b912-9bf5-d6cf-9da5b982c955@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --cc=cygwin@cygwin.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).