[BusyBox] [PATH] ln, better error messages
Bastian Blank
waldi at debian.org
Wed Dec 31 16:04:55 UTC 2003
hi folks
this patch fixes the error message of ln, it fixes debian:#216435.
bastian
--
Captain's Log, star date 21:34.5...
-------------- next part --------------
Index: coreutils/ln.c
===================================================================
--- coreutils/ln.c (revision 114)
+++ coreutils/ln.c (working copy)
@@ -43,7 +43,8 @@
int flag;
char *last;
char *src_name;
- const char *src;
+ char *src;
+ struct stat statbuf;
int (*link_func)(const char *, const char *);
flag = bb_getopt_ulflags(argc, argv, "sfn");
@@ -61,7 +62,7 @@
}
do {
- src_name = 0;
+ src_name = NULL;
src = last;
if (is_directory(src,
@@ -70,9 +71,16 @@
src_name = bb_xstrdup(*argv);
src = concat_path_file(src, bb_get_last_path_component(src_name));
free(src_name);
- src_name = (char *)src;
+ src_name = src;
}
+ if (stat(*argv, &statbuf)) {
+ bb_perror_msg(*argv);
+ status = EXIT_FAILURE;
+ free(src_name);
+ break;
+ }
+
if (flag & LN_FORCE) {
unlink(src);
}
@@ -84,7 +92,7 @@
if (link_func(*argv, src) != 0) {
bb_perror_msg(src);
- status = EXIT_FAILURE;;
+ status = EXIT_FAILURE;
}
free(src_name);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.busybox.net/pipermail/busybox/attachments/20031231/a5d1f5ea/attachment-0002.pgp
More information about the busybox
mailing list