]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(utime_now): Moved into m4/utimes.m4.
authorJim Meyering <jim@meyering.net>
Sat, 25 Jul 1998 13:20:49 +0000 (13:20 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 25 Jul 1998 13:20:49 +0000 (13:20 +0000)
(touch) [!HAVE_UTIME_NULL]: Remove #ifdef and use of utime_now in if-block.

src/touch.c

index cb82831ab4e5ea4f0ed935b7bd1e4587b04975cc..b0d89fe9805fff43f71319b1c256e2469e91f157 100644 (file)
@@ -52,10 +52,6 @@ time_t posixtime ();
 int full_write ();
 void invalid_arg ();
 
-#if ! HAVE_UTIME_NULL
-static int utime_now ();
-#endif
-
 /* Bitmasks for `change_times'. */
 #define CH_ATIME 1
 #define CH_MTIME 2
@@ -171,13 +167,9 @@ touch (char *file)
 
   if (amtime_now)
     {
-#if ! HAVE_UTIME_NULL
-      status = utime_now (file, sbuf.st_size);
-#else
       /* Pass NULL to utime so it will not fail if we just have
         write access to the file, but don't own it.  */
       status = utime (file, NULL);
-#endif
     }
   else
     {
@@ -209,32 +201,6 @@ touch (char *file)
   return 0;
 }
 
-#if ! HAVE_UTIME_NULL
-/* Emulate utime (file, NULL) for systems (like 4.3BSD) that do not
-   interpret it to set the access and modification times of FILE to
-   the current time.  FILESIZE is the correct size of FILE, used to
-   make sure empty files are not lengthened to 1 byte.
-   Return 0 if successful, -1 if not. */
-
-static int
-utime_now (const char *file, off_t filesize)
-{
-  int fd;
-  char c;
-  int status = 0;
-
-  fd = open (file, O_RDWR, 0666);
-  if (fd < 0
-      || safe_read (fd, &c, sizeof (char)) < 0
-      || lseek (fd, (off_t) 0, SEEK_SET) < 0
-      || full_write (fd, &c, sizeof (char)) < 0
-      || ftruncate (fd, filesize) < 0
-      || close (fd) < 0)
-    status = -1;
-  return status;
-}
-#endif
-
 static void
 usage (int status)
 {