This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Bug in TIME function
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Thu, 12 Sep 2019 12:44:47 -0600
- Subject: Re: Bug in TIME function
- References: <009d01d56994$a8065040$f812f0c0$@twcny.rr.com>
- Reply-to: Brian dot Inglis at SystematicSw dot ab dot ca
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