aboutsummaryrefslogtreecommitdiff
path: root/ln.c
diff options
context:
space:
mode:
Diffstat (limited to 'ln.c')
-rw-r--r--ln.c29
1 files changed, 2 insertions, 27 deletions
diff --git a/ln.c b/ln.c
index 3c45dee33..71d84f066 100644
--- a/ln.c
+++ b/ln.c
@@ -92,13 +92,7 @@ extern int ln_main(int argc, char **argv)
92 92
93 linkName = argv[argc - 1]; 93 linkName = argv[argc - 1];
94 94
95 if (strlen(linkName) > BUFSIZ) { 95 linkIntoDirFlag = isDirectory(linkName, followLinks, NULL);
96 fprintf(stderr, name_too_long, "ln");
97 exit FALSE;
98 }
99
100 linkIntoDirFlag = isDirectory(linkName, TRUE, NULL);
101
102 if ((argc >= 3) && linkIntoDirFlag == FALSE) { 96 if ((argc >= 3) && linkIntoDirFlag == FALSE) {
103 fprintf(stderr, not_a_directory, "ln", linkName); 97 fprintf(stderr, not_a_directory, "ln", linkName);
104 exit FALSE; 98 exit FALSE;
@@ -108,27 +102,8 @@ extern int ln_main(int argc, char **argv)
108 dirName = linkName; 102 dirName = linkName;
109 103
110 while (argc-- >= 2) { 104 while (argc-- >= 2) {
111#if 0
112 char srcName[BUFSIZ + 1];
113 int nChars;
114#endif
115 int status; 105 int status;
116 106
117 if (strlen(*argv) > BUFSIZ) {
118 fprintf(stderr, name_too_long, "ln");
119 exit FALSE;
120 }
121
122#if 0
123 if (followLinks == FALSE) {
124 strcpy(srcName, *argv);
125 } else {
126 /* Warning! This can silently truncate if > BUFSIZ, but
127 I don't think that there can be one > BUFSIZ anyway. */
128 nChars = readlink(*argv, srcName, BUFSIZ);
129 srcName[nChars] = '\0';
130 }
131#endif
132 if (linkIntoDirFlag == TRUE) { 107 if (linkIntoDirFlag == TRUE) {
133 char *baseName = get_last_path_component(*argv); 108 char *baseName = get_last_path_component(*argv);
134 linkName = (char *)malloc(strlen(dirName)+strlen(baseName)+2); 109 linkName = (char *)malloc(strlen(dirName)+strlen(baseName)+2);
@@ -155,7 +130,7 @@ extern int ln_main(int argc, char **argv)
155 exit FALSE; 130 exit FALSE;
156 } 131 }
157 132
158 if (linkIntoDirFlag) 133 if (linkIntoDirFlag == TRUE)
159 free(linkName); 134 free(linkName);
160 135
161 argv++; 136 argv++;