Pavel Roskin <proski@gnu.org> just found a nasty memory

corruption bug.  Disabling 'ln -n' till it is fixed.
 -Erik
This commit is contained in:
Eric Andersen 2000-06-22 00:02:56 +00:00
parent addc9c28ad
commit 6f9985e2f2
2 changed files with 16 additions and 2 deletions

View File

@ -40,7 +40,9 @@ static const char ln_usage[] =
"\t-s\tmake symbolic links instead of hard links\n" "\t-s\tmake symbolic links instead of hard links\n"
"\t-f\tremove existing destination files\n" "\t-f\tremove existing destination files\n"
#if 0
"\t-n\tno dereference symlinks - treat like normal file\n" "\t-n\tno dereference symlinks - treat like normal file\n"
#endif
#endif #endif
; ;
@ -103,14 +105,18 @@ extern int ln_main(int argc, char **argv)
} }
while (argc-- >= 2) { while (argc-- >= 2) {
#if 0
char srcName[BUFSIZ + 1]; char srcName[BUFSIZ + 1];
int nChars, status; int nChars;
#endif
int status;
if (strlen(*argv) > BUFSIZ) { if (strlen(*argv) > BUFSIZ) {
fprintf(stderr, name_too_long, "ln"); fprintf(stderr, name_too_long, "ln");
exit FALSE; exit FALSE;
} }
#if 0
if (followLinks == FALSE) { if (followLinks == FALSE) {
strcpy(srcName, *argv); strcpy(srcName, *argv);
} else { } else {
@ -119,6 +125,7 @@ extern int ln_main(int argc, char **argv)
nChars = readlink(*argv, srcName, BUFSIZ); nChars = readlink(*argv, srcName, BUFSIZ);
srcName[nChars] = '\0'; srcName[nChars] = '\0';
} }
#endif
if (removeoldFlag == TRUE) { if (removeoldFlag == TRUE) {
status = (unlink(linkName) && errno != ENOENT); status = (unlink(linkName) && errno != ENOENT);

9
ln.c
View File

@ -40,7 +40,9 @@ static const char ln_usage[] =
"\t-s\tmake symbolic links instead of hard links\n" "\t-s\tmake symbolic links instead of hard links\n"
"\t-f\tremove existing destination files\n" "\t-f\tremove existing destination files\n"
#if 0
"\t-n\tno dereference symlinks - treat like normal file\n" "\t-n\tno dereference symlinks - treat like normal file\n"
#endif
#endif #endif
; ;
@ -103,14 +105,18 @@ extern int ln_main(int argc, char **argv)
} }
while (argc-- >= 2) { while (argc-- >= 2) {
#if 0
char srcName[BUFSIZ + 1]; char srcName[BUFSIZ + 1];
int nChars, status; int nChars;
#endif
int status;
if (strlen(*argv) > BUFSIZ) { if (strlen(*argv) > BUFSIZ) {
fprintf(stderr, name_too_long, "ln"); fprintf(stderr, name_too_long, "ln");
exit FALSE; exit FALSE;
} }
#if 0
if (followLinks == FALSE) { if (followLinks == FALSE) {
strcpy(srcName, *argv); strcpy(srcName, *argv);
} else { } else {
@ -119,6 +125,7 @@ extern int ln_main(int argc, char **argv)
nChars = readlink(*argv, srcName, BUFSIZ); nChars = readlink(*argv, srcName, BUFSIZ);
srcName[nChars] = '\0'; srcName[nChars] = '\0';
} }
#endif
if (removeoldFlag == TRUE) { if (removeoldFlag == TRUE) {
status = (unlink(linkName) && errno != ENOENT); status = (unlink(linkName) && errno != ENOENT);