diff options
Diffstat (limited to 'openembedded/packages/busybox/busybox-1.01/readlink.patch')
-rw-r--r-- | openembedded/packages/busybox/busybox-1.01/readlink.patch | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/openembedded/packages/busybox/busybox-1.01/readlink.patch b/openembedded/packages/busybox/busybox-1.01/readlink.patch new file mode 100644 index 0000000000..0c5431085a --- /dev/null +++ b/openembedded/packages/busybox/busybox-1.01/readlink.patch | |||
@@ -0,0 +1,85 @@ | |||
1 | diff -p -u -r1.7 Config.in | ||
2 | --- busybox-1.00/debianutils/Config.in 15 Mar 2004 08:28:24 -0000 1.7 | ||
3 | +++ busybox-1.00-patched/debianutils/Config.in 16 Nov 2004 11:46:41 -0000 | ||
4 | @@ -24,6 +24,13 @@ config CONFIG_READLINK | ||
5 | This program reads a symbolic link and returns the name | ||
6 | of the file it points to | ||
7 | |||
8 | +config CONFIG_FEATURE_READLINK_FOLLOW | ||
9 | + bool " Enable canonicalization by following all symlinks (-f)" | ||
10 | + default n | ||
11 | + depends on CONFIG_READLINK | ||
12 | + help | ||
13 | + Enable the readlink option (-f). | ||
14 | + | ||
15 | config CONFIG_RUN_PARTS | ||
16 | bool "run-parts" | ||
17 | default n | ||
18 | diff -p -u -r1.2 readlink.c | ||
19 | --- busybox-1.00/debianutils/readlink.c 19 Mar 2003 09:11:41 -0000 1.2 | ||
20 | +++ busybox-1.00-patched/debianutils/readlink.c 16 Nov 2004 11:46:41 -0000 | ||
21 | @@ -23,18 +23,38 @@ | ||
22 | #include <errno.h> | ||
23 | #include <unistd.h> | ||
24 | #include <stdlib.h> | ||
25 | +#include <getopt.h> | ||
26 | #include "busybox.h" | ||
27 | |||
28 | +#ifdef CONFIG_FEATURE_READLINK_FOLLOW | ||
29 | +# define READLINK_FOLLOW "f" | ||
30 | +# define READLINK_FLAG_f (1 << 0) | ||
31 | +#else | ||
32 | +# define READLINK_FOLLOW "" | ||
33 | +#endif | ||
34 | + | ||
35 | +static const char readlink_options[] = READLINK_FOLLOW; | ||
36 | + | ||
37 | int readlink_main(int argc, char **argv) | ||
38 | { | ||
39 | char *buf = NULL; | ||
40 | + unsigned long opt = bb_getopt_ulflags(argc, argv, readlink_options); | ||
41 | +#ifdef CONFIG_FEATURE_READLINK_FOLLOW | ||
42 | + RESERVE_CONFIG_BUFFER(resolved_path, PATH_MAX); | ||
43 | +#endif | ||
44 | |||
45 | /* no options, no getopt */ | ||
46 | |||
47 | - if (argc != 2) | ||
48 | + if (optind + 1 != argc) | ||
49 | bb_show_usage(); | ||
50 | |||
51 | - buf = xreadlink(argv[1]); | ||
52 | +#ifdef CONFIG_FEATURE_READLINK_FOLLOW | ||
53 | + if (opt & READLINK_FLAG_f) { | ||
54 | + buf = realpath(argv[optind], resolved_path); | ||
55 | + } else | ||
56 | +#endif | ||
57 | + buf = xreadlink(argv[optind]); | ||
58 | + | ||
59 | if (!buf) | ||
60 | return EXIT_FAILURE; | ||
61 | puts(buf); | ||
62 | diff -p -u -r1.222 usage.h | ||
63 | --- busybox-1.00/include/usage.h 14 Sep 2004 16:23:56 -0000 1.222 | ||
64 | +++ busybox-1.00-patched/include/usage.h 16 Nov 2004 11:46:42 -0000 | ||
65 | @@ -1985,10 +1985,18 @@ | ||
66 | "\t-s\tSet the system date and time (default).\n" \ | ||
67 | "\t-p\tPrint the date and time." | ||
68 | |||
69 | +#ifdef CONFIG_FEATURE_READLINK_FOLLOW | ||
70 | +#define USAGE_READLINK_FOLLOW(a) a | ||
71 | +#else | ||
72 | +#define USAGE_READLINK_FOLLOW(a) | ||
73 | +#endif | ||
74 | + | ||
75 | #define readlink_trivial_usage \ | ||
76 | - "" | ||
77 | + USAGE_READLINK_FOLLOW("[-f] ") "FILE" | ||
78 | #define readlink_full_usage \ | ||
79 | - "Displays the value of a symbolic link." | ||
80 | + "Displays the value of a symbolic link." \ | ||
81 | + USAGE_READLINK_FOLLOW("\n\nOptions:\n" \ | ||
82 | + "\t-f\tcanonicalize by following all symlinks") | ||
83 | |||
84 | #define realpath_trivial_usage \ | ||
85 | "pathname ..." | ||