summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-07-25 13:20:49 +0000
committerJim Meyering <jim@meyering.net>1998-07-25 13:20:49 +0000
commitfc13bb65df0b23e8b93d893a6e99aa5c447a5910 (patch)
tree77b55879f16efafceb635bb3476bdd8181257da2 /src
parent27f3ca3d5af92f583b6d94c4ada33e7dabc7a8fd (diff)
downloadcoreutils-fc13bb65df0b23e8b93d893a6e99aa5c447a5910.tar.xz
(utime_now): Moved into m4/utimes.m4.
(touch) [!HAVE_UTIME_NULL]: Remove #ifdef and use of utime_now in if-block.
Diffstat (limited to 'src')
-rw-r--r--src/touch.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/touch.c b/src/touch.c
index cb82831ab..b0d89fe98 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -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)
{