[PATCH] Ignore touch -f flag
Tobias Poschwatta
tp at fonz.de
Mon Nov 26 05:47:14 PST 2007
Hi all,
below is a small patch to make 'touch' accept and ignore the -f flag.
(-f is ignored by coreutils touch, too). I stumbled over this when
trying to bootstrap pkgsrc on a uclibc/busybox system (which now
succeeds).
Tobias
--- busybox-1.8.1/coreutils/touch.c.orig 2007-11-24 19:07:42.000000000 +0100
+++ busybox-1.8.1/coreutils/touch.c 2007-11-24 19:11:12.000000000 +0100
@@ -21,12 +21,15 @@
/* This is a NOFORK applet. Be very careful! */
+#define TOUCH_OPT_NOCREATE 1
+#define TOUCH_OPT_F 2
+
int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int touch_main(int argc, char **argv)
{
int fd;
int status = EXIT_SUCCESS;
- int flags = getopt32(argv, "c");
+ int flags = getopt32(argv, "cf");
argv += optind;
@@ -37,7 +40,7 @@
do {
if (utime(*argv, NULL)) {
if (errno == ENOENT) { /* no such file */
- if (flags) { /* Creation is disabled, so ignore. */
+ if (flags & TOUCH_OPT_NOCREATE) { /* Creation is disabled, so ignore. */
continue;
}
/* Try to create the file. */
More information about the busybox
mailing list