delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/07/10/17:06:22

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Message-ID: <20050710210612.40137.qmail@web88010.mail.re2.yahoo.com>
Date: Sun, 10 Jul 2005 17:06:12 -0400 (EDT)
From: Brian Bisaillon <brian_bisaillon AT rogers DOT com>
Subject: localtime_r segfaults, localtime doesn't... same values passed to each function...
To: cygwin AT cygwin DOT com
MIME-Version: 1.0

This works...
 
struct tm *sci_localtime (time_t timep) {
    struct tm *result;
    if ((result = localtime(&timep)) == NULL) {
    int errsv = errno;
        fprintf (stderr, "\nError Code %i: %s at line
%i of %s function in %s \
            \n", strerror (errsv), 2,
"sci_localtime_r", "sci_time.c");
        exit (EXIT_FAILURE);
    } else {
        return (result);
    }
}
 
This doesn't...
 
struct tm *sci_localtime_r (time_t timep) {
    struct tm *result;
    if ((localtime_r(&timep, result)) == NULL) {
    int errsv = errno;
        fprintf (stderr, "\nError Code %i: %s at line
%i of %s function in %s \
            \n", strerror (errsv), 2,
"sci_localtime_r", "sci_time.c");
        exit (EXIT_FAILURE);
    } else {
        return (result);
    }
}
 
Keep in mind, I have a wrapper for time() and
asctime_r() and they work just fine. The segfault is
being caused by localtime_r(). I mean I changed it to
localtime() and everything worked. When I change it
back to localtime_r() it doesn't. Anyone ever
encounter this bug? Anyway, I plan to update my Cygwin
DLL to see if it fixes the problem.

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

- Raw text -


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