From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90862 invoked by alias); 12 Sep 2019 18:44:52 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 90379 invoked by uid 89); 12 Sep 2019 18:44:52 -0000 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 Received: from smtp-out-so.shaw.ca (HELO smtp-out-so.shaw.ca) (64.59.136.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Sep 2019 18:44:50 +0000 Received: from [192.168.1.114] ([24.64.172.44]) by shaw.ca with ESMTP id 8U5HieoQxSrVc8U5IiepER; Thu, 12 Sep 2019 12:44:48 -0600 Reply-To: Brian.Inglis@SystematicSw.ab.ca Subject: Re: Bug in TIME function To: cygwin@cygwin.com References: <009d01d56994$a8065040$f812f0c0$@twcny.rr.com> From: Brian Inglis Openpgp: preference=signencrypt Message-ID: <78512bbe-b912-9bf5-d6cf-9da5b982c955@SystematicSw.ab.ca> Date: Thu, 12 Sep 2019 23:03:00 -0000 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> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00144.txt.bz2 On 2019-09-12 12:05, tlake@twcny.rr.com wrote: > The code below returns -1. It shouldn't. > #include > #include > 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