| 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 /var/archive3/public/freebsd-releng-10.4-src/bin/ln/ln.c freebsd-10.4/bin/ln/ln.c |
| --- /var/archive3/public/freebsd-releng-10.4-src/bin/ln/ln.c 2017-09-29 08:21:08.000000000 +0800 |
| +++ freebsd-10.4/bin/ln/ln.c 2019-08-18 00:18:17.448148470 +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 /var/archive3/public/freebsd-releng-10.4-src/bin/rm/rm.c freebsd-10.4/bin/rm/rm.c |
| --- /var/archive3/public/freebsd-releng-10.4-src/bin/rm/rm.c 2017-09-29 08:21:09.000000000 +0800 |
| +++ freebsd-10.4/bin/rm/rm.c 2019-08-18 00:18:17.449158510 +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; |