blob: 1803736c43270d9f9cf2b89db6bb2b1c5187ae18 [file] [log] [blame] [raw]
Use link(2) or unlink(2) directly if ln(1) or rm(1) was started with such names.
diff -ru --exclude-from freebsd-src-diff-exclude-names /usr/src/bin/ln/ln.c freebsd-11.1/usr/src/bin/ln/ln.c
--- /usr/src/bin/ln/ln.c 2017-07-21 07:43:20.000000000 +0800
+++ freebsd-11.1/usr/src/bin/ln/ln.c 2019-03-22 16:57:52.738332000 +0800
@@ -91,7 +91,13 @@
argv += optind;
if (argc != 2)
usage();
- exit(linkit(argv[0], argv[1], 0));
+ /* The link(2) system call should be used directly */
+ if(link(argv[0], argv[1]) < 0) {
+ fprintf(stderr, "link: %s -> %s: %s\n",
+ argv[0], argv[1], strerror(errno));
+ return 1;
+ }
+ return 0;
}
while ((ch = getopt(argc, argv, "FLPfhinsvw")) != -1)
diff -ru --exclude-from freebsd-src-diff-exclude-names /usr/src/bin/rm/rm.c freebsd-11.1/usr/src/bin/rm/rm.c
--- /usr/src/bin/rm/rm.c 2017-07-21 07:43:20.000000000 +0800
+++ freebsd-11.1/usr/src/bin/rm/rm.c 2019-03-22 17:00:22.162689000 +0800
@@ -105,8 +105,12 @@
argv += optind;
if (argc != 1)
usage();
- rm_file(&argv[0]);
- exit(eval);
+ /* The unlink(2) system call should be used directly */
+ if(unlink(*argv) < 0) {
+ perror(*argv);
+ return 1;
+ }
+ return 0;
}
Pflag = rflag = xflag = 0;