bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ls -l bug with fileutils-4.1 on Mac OS X


From: Bernhard Baehr
Subject: ls -l bug with fileutils-4.1 on Mac OS X
Date: Sat, 14 Jul 2001 20:57:10 +0200

Hi,

today I installed the GNU fileutils 4.1 on my Mac (Mac OS X 10.0.4, i. e. Darwin 1.3.7) to get color file lists. I found that for all kinds of long output of ls the first file in the output list was shown with the current date and time and not with the correct date and time from the files inode. The reason for this bug is that with Mac OS X gettimeofday() overwrites the global buffer thats address is returned by localtime(). But the ls output routine print_long_format() assumes that this global buffer remains intact. I´ve fixed the bug with the following patch for the source file ls.c.

Regards,
Bernhard Baehr


[cube:src/fileutils-4.1/src] bb% diff ls.c.orig ls.c
2455c2455
<   struct tm *when_local;
---
>   struct tm *when_local_ptr, when_local;
2539c2539
<   if ((when_local = localtime (&when)))
---
>   if ((when_local_ptr = localtime (&when)))
2544a2545,2548
> /* Save the global tm buffer returned by localtime(). With Mac OS X, > get_current_time() (actually gettimeofday()) overwrites it. */
>        when_local = *when_local_ptr;
>
2566c2570
<         s = strftime (p, buf + bufsize - p - 1, fmt, when_local);
---
>         s = strftime (p, buf + bufsize - p - 1, fmt, &when_local);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]