bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] utimes problem: linux libc/kernel header mismatch?


From: Jim Meyering
Subject: [Bug-gnulib] utimes problem: linux libc/kernel header mismatch?
Date: Sat, 09 Aug 2003 22:46:00 +0200

FYI,

Here are the symptoms of the utimes failure I mentioned recently.

  $ cat utimes.c
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <unistd.h>
  #include <stdlib.h>
  #include <stdio.h>

  #include <utime.h>
  #include <sys/time.h>

  int
  main ()
  {
    char const *file = "x";
    static struct timeval timeval[2] = {{1, 2}, {3, 4}};
    if (utimes (file, timeval))
      perror (file), exit (1);

    {
      struct stat sbuf;
      if (lstat (file, &sbuf))
        exit (2);

      if (sbuf.st_atime != 1)
        exit (3);

      if (sbuf.st_mtime != 3)
        exit (4);
    }
    exit (0);
  }
  $ gcc -W -g -Wall utimes.c
  $ touch x
  $ ./a.out
  [Exit 3]
  $ strace -e utime ./a.out
  utime("x", [0, 0])                      = 0
  $

My environment:

  - Debian/unstable system with linux-2.4.21-3-k7 (updated last night)
  - gcc version 3.3.1 (Debian)

  $ /lib/libc.so.6
  GNU C Library stable release version 2.3.2, by Roland McGrath et al.
  ...
  Compiled by GNU CC version 3.3.1 20030728 (Debian prerelease).
  Compiled on a Linux 2.4.21-3 system on 2003-08-06.
  Available extensions:
  ...




reply via email to

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