diff options
author | Rod Whitby <rod@whitby.id.au> | 2007-06-17 05:37:26 +0000 |
---|---|---|
committer | Rod Whitby <rod@whitby.id.au> | 2007-06-17 05:37:26 +0000 |
commit | 4171ca7ea616dffcad66ef7968e8adb4f5a577b9 (patch) | |
tree | 8af4acb7f1de7aeb5cab546437bf2f27f5c76b49 /packages/busybox/busybox-static-1.2.1/readlink.patch | |
parent | f4cca286a441f6b3ee710d7e40ec8d95d01b5449 (diff) | |
parent | 43685cdd4112bd3038436a6f4059d9eda54ee0c9 (diff) |
merge of '2b1cc78c259b50ef47b34d85e4f6717f64d1d093'
and 'ed459a8f7a87918dd43a1513e367c3dd386e56be'
Diffstat (limited to 'packages/busybox/busybox-static-1.2.1/readlink.patch')
-rw-r--r-- | packages/busybox/busybox-static-1.2.1/readlink.patch | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/packages/busybox/busybox-static-1.2.1/readlink.patch b/packages/busybox/busybox-static-1.2.1/readlink.patch new file mode 100644 index 0000000000..0c5431085a --- /dev/null +++ b/packages/busybox/busybox-static-1.2.1/readlink.patch @@ -0,0 +1,85 @@ +diff -p -u -r1.7 Config.in +--- busybox-1.00/debianutils/Config.in 15 Mar 2004 08:28:24 -0000 1.7 ++++ busybox-1.00-patched/debianutils/Config.in 16 Nov 2004 11:46:41 -0000 +@@ -24,6 +24,13 @@ config CONFIG_READLINK + This program reads a symbolic link and returns the name + of the file it points to + ++config CONFIG_FEATURE_READLINK_FOLLOW ++ bool " Enable canonicalization by following all symlinks (-f)" ++ default n ++ depends on CONFIG_READLINK ++ help ++ Enable the readlink option (-f). ++ + config CONFIG_RUN_PARTS + bool "run-parts" + default n +diff -p -u -r1.2 readlink.c +--- busybox-1.00/debianutils/readlink.c 19 Mar 2003 09:11:41 -0000 1.2 ++++ busybox-1.00-patched/debianutils/readlink.c 16 Nov 2004 11:46:41 -0000 +@@ -23,18 +23,38 @@ + #include <errno.h> + #include <unistd.h> + #include <stdlib.h> ++#include <getopt.h> + #include "busybox.h" + ++#ifdef CONFIG_FEATURE_READLINK_FOLLOW ++# define READLINK_FOLLOW "f" ++# define READLINK_FLAG_f (1 << 0) ++#else ++# define READLINK_FOLLOW "" ++#endif ++ ++static const char readlink_options[] = READLINK_FOLLOW; ++ + int readlink_main(int argc, char **argv) + { + char *buf = NULL; ++ unsigned long opt = bb_getopt_ulflags(argc, argv, readlink_options); ++#ifdef CONFIG_FEATURE_READLINK_FOLLOW ++ RESERVE_CONFIG_BUFFER(resolved_path, PATH_MAX); ++#endif + + /* no options, no getopt */ + +- if (argc != 2) ++ if (optind + 1 != argc) + bb_show_usage(); + +- buf = xreadlink(argv[1]); ++#ifdef CONFIG_FEATURE_READLINK_FOLLOW ++ if (opt & READLINK_FLAG_f) { ++ buf = realpath(argv[optind], resolved_path); ++ } else ++#endif ++ buf = xreadlink(argv[optind]); ++ + if (!buf) + return EXIT_FAILURE; + puts(buf); +diff -p -u -r1.222 usage.h +--- busybox-1.00/include/usage.h 14 Sep 2004 16:23:56 -0000 1.222 ++++ busybox-1.00-patched/include/usage.h 16 Nov 2004 11:46:42 -0000 +@@ -1985,10 +1985,18 @@ + "\t-s\tSet the system date and time (default).\n" \ + "\t-p\tPrint the date and time." + ++#ifdef CONFIG_FEATURE_READLINK_FOLLOW ++#define USAGE_READLINK_FOLLOW(a) a ++#else ++#define USAGE_READLINK_FOLLOW(a) ++#endif ++ + #define readlink_trivial_usage \ +- "" ++ USAGE_READLINK_FOLLOW("[-f] ") "FILE" + #define readlink_full_usage \ +- "Displays the value of a symbolic link." ++ "Displays the value of a symbolic link." \ ++ USAGE_READLINK_FOLLOW("\n\nOptions:\n" \ ++ "\t-f\tcanonicalize by following all symlinks") + + #define realpath_trivial_usage \ + "pathname ..." |