[BusyBox-cvs] busybox/coreutils ln.c,1.42,1.43
Glenn McGrath
bug1 at busybox.net
Wed Dec 31 23:10:47 UTC 2003
Update of /var/cvs/busybox/coreutils
In directory nail:/tmp/cvs-serv20802/coreutils
Modified Files:
ln.c
Log Message:
Batch from Bastian Blank to fix debian bug #216435;
When linking a non existing file busybox ln will report the target
missind and not the source:
Index: ln.c
===================================================================
RCS file: /var/cvs/busybox/coreutils/ln.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- ln.c 14 Jul 2003 21:20:44 -0000 1.42
+++ ln.c 31 Dec 2003 23:10:44 -0000 1.43
@@ -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,7 +71,14 @@
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);
+ continue;
}
if (flag & LN_FORCE) {
@@ -84,7 +92,7 @@
if (link_func(*argv, src) != 0) {
bb_perror_msg(src);
- status = EXIT_FAILURE;;
+ status = EXIT_FAILURE;
}
free(src_name);
More information about the busybox-cvs
mailing list