delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/09/12/14:45:45

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=MU2R91xzUCMPx6py
QtHQd1MihmHzQW/z30lImYHOHWHPIl29H8QynAppGc2uhD/xShMjcbog2m0TRe+j
qSGw99a2vukW4LvHrX4hW8DRWLuZ4T+e1qMOxXvPDpt53qZO98wn/+QcJikXpiIj
34EgFMKuQotNVvnYBQMhnl3n+DQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=98zbblzfaDYYIzyYF2D+ir
HEHxs=; b=I0tTD3EOK+2s3C8KrRWgKx8fiQLhdVVBphU/xZ35hpPgM5j4t6NsKf
Mgb9fXp9wjho/b1/vhvD3lBZ8VSl7mex90tXybL4zh2jLltgtXXa3OF+SiLBx+Im
uyn4SMjE8I7Trfya9lfhg8OOHBG9VG6xsBL4V/oRjEcWlUH7T7DHo=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=
X-HELO: smtp-out-so.shaw.ca
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Subject: Re: Bug in TIME function
To: cygwin AT cygwin DOT com
References: <009d01d56994$a8065040$f812f0c0$@twcny.rr.com>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Openpgp: preference=signencrypt
Message-ID: <78512bbe-b912-9bf5-d6cf-9da5b982c955@SystematicSw.ab.ca>
Date: Thu, 12 Sep 2019 12:44:47 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0
MIME-Version: 1.0
In-Reply-To: <009d01d56994$a8065040$f812f0c0$@twcny.rr.com>
X-IsSubscribed: yes

On 2019-09-12 12:05, tlake AT twcny DOT rr DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019