aboutsummaryrefslogtreecommitdiff
path: root/coreutils/readlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/readlink.c')
-rw-r--r--coreutils/readlink.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/coreutils/readlink.c b/coreutils/readlink.c
index 9690290e3..b8e327d11 100644
--- a/coreutils/readlink.c
+++ b/coreutils/readlink.c
@@ -20,7 +20,7 @@
20//config: help 20//config: help
21//config: Enable the readlink option (-f). 21//config: Enable the readlink option (-f).
22 22
23//applet:IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP)) 23//applet:IF_READLINK(APPLET_NOFORK(readlink, readlink, BB_DIR_USR_BIN, BB_SUID_DROP, readlink))
24 24
25//kbuild:lib-$(CONFIG_READLINK) += readlink.o 25//kbuild:lib-$(CONFIG_READLINK) += readlink.o
26 26
@@ -71,8 +71,7 @@ int readlink_main(int argc UNUSED_PARAM, char **argv)
71 IF_FEATURE_READLINK_FOLLOW( 71 IF_FEATURE_READLINK_FOLLOW(
72 unsigned opt; 72 unsigned opt;
73 /* We need exactly one non-option argument. */ 73 /* We need exactly one non-option argument. */
74 opt_complementary = "=1"; 74 opt = getopt32(argv, "^" "fnvsq" "\0" "=1");
75 opt = getopt32(argv, "fnvsq");
76 fname = argv[optind]; 75 fname = argv[optind];
77 ) 76 )
78 IF_NOT_FEATURE_READLINK_FOLLOW( 77 IF_NOT_FEATURE_READLINK_FOLLOW(
@@ -85,6 +84,7 @@ int readlink_main(int argc UNUSED_PARAM, char **argv)
85 if (!(opt & 4)) /* not -v */ 84 if (!(opt & 4)) /* not -v */
86 logmode = LOGMODE_NONE; 85 logmode = LOGMODE_NONE;
87 86
87 /* NOFORK: only one alloc is allowed; must free */
88 if (opt & 1) { /* -f */ 88 if (opt & 1) { /* -f */
89 buf = xmalloc_realpath(fname); 89 buf = xmalloc_realpath(fname);
90 } else { 90 } else {
@@ -94,9 +94,7 @@ int readlink_main(int argc UNUSED_PARAM, char **argv)
94 if (!buf) 94 if (!buf)
95 return EXIT_FAILURE; 95 return EXIT_FAILURE;
96 printf((opt & 2) ? "%s" : "%s\n", buf); 96 printf((opt & 2) ? "%s" : "%s\n", buf);
97 97 free(buf);
98 if (ENABLE_FEATURE_CLEAN_UP)
99 free(buf);
100 98
101 fflush_stdout_and_exit(EXIT_SUCCESS); 99 fflush_stdout_and_exit(EXIT_SUCCESS);
102} 100}