| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT sources DOT redhat DOT com |
| Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
| From: | "Lothan" <lothan AT newsguy DOT com> |
| To: | "Cygnus" <cygwin AT sourceware DOT cygnus DOT com> |
| Subject: | RE: date +"%Z" |
| Date: | Thu, 1 Feb 2001 02:01:03 -0800 |
| Message-ID: | <EJEMICJMAGCJAPFPGPLGOEDHCHAA.lothan@newsguy.com> |
| MIME-Version: | 1.0 |
| X-Priority: | 3 (Normal) |
| X-MSMail-Priority: | Normal |
| X-Mailer: | Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4133.2400 |
| In-Reply-To: | <3A78CE75.6B336DAA@Wanadoo.fr> |
| Importance: | Normal |
> From: cygwin-owner AT sources DOT redhat DOT com
> [mailto:cygwin-owner AT sources DOT redhat DOT com]On Behalf Of Jerome BENOIT
> Sent: Wednesday, January 31, 2001 6:48 PM
> To: Cygnus
> Subject: date +"%Z"
>
>
> Hello !
>
> It seems that the command line
>
> date +"%Z"
>
> hangs under Win98.
>
> I hope it helps,
> Jerome BENOIT
The problem is in this section of code in the show_date() routine in date.c:
do
{
out_length += 200;
out = (char *) xrealloc(out, out_length);
}
while(strftime(out, out_length, format, tm) == 0);
It allocates memory 200 bytes at a time until strftime() returns a success
status. The basic premise seems to be to allocate a large enough buffer for
strftime() to write the specified date format into. Unfortunately it's
bumping heads with this basic code in strftime():
size_t count = 0;
switch(*format)
{
case "Z":
break;
}
s[count] = '\0';
return count;
In this case strftime() doesn't support the %Z format, so it always returns
zero. This leads to the code in date continuously allocating memory until
it's completely exhausted.
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |