busybox/bugfix-crontab_remove_bug.patch

19 lines
500 B
Diff
Raw Normal View History

diff -Nur old/miscutils/crontab.c new/miscutils/crontab.c
--- old/miscutils/crontab.c 2015-11-30 14:45:22.000000000 +0800
+++ new/miscutils/crontab.c 2015-11-30 15:25:36.000000000 +0800
@@ -153,7 +153,13 @@
switch (opt_ler) {
default: /* case OPT_r: Delete */
- unlink(pas->pw_name);
+ if(unlink(pas->pw_name) != 0){
+ if(errno == ENOENT)
+ fprintf(stderr, "no crontab for %s\n", pas->pw_name);
+ else
+ perror(pas->pw_name);
+ exit(1);
+ }
break;
case OPT_l: /* List */