From: Thibault Godouet Date: Sun, 11 Jun 2000 20:30:37 +0000 (+0000) Subject: corrected a minor bug which used to occur when a user given X-Git-Tag: ver2_9_4~702 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce4172241b49342389de4f7e5176e7ee7e64bdd3;p=thirdparty%2Ffcron.git corrected a minor bug which used to occur when a user given by the -u option wasn't in the /etc/passwd file --- diff --git a/fcrontab.c b/fcrontab.c index 15687f0..877f853 100644 --- a/fcrontab.c +++ b/fcrontab.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fcrontab.c,v 1.4 2000-05-30 19:26:58 thib Exp $ */ + /* $Id: fcrontab.c,v 1.5 2000-06-11 20:30:37 thib Exp $ */ /* * The goal of this program is simple : giving a user interface to fcron @@ -42,7 +42,7 @@ #include "fcrontab.h" -char rcs_info[] = "$Id: fcrontab.c,v 1.4 2000-05-30 19:26:58 thib Exp $"; +char rcs_info[] = "$Id: fcrontab.c,v 1.5 2000-06-11 20:30:37 thib Exp $"; void info(void); void usage(void); @@ -523,11 +523,16 @@ parseopt(int argc, char *argv[]) } } - if ( user == NULL ) + if ( user == NULL ) { if ((user = getenv("USER")) == NULL) { fprintf(stderr, "Could not get user name.\n"); xexit(EXIT_ERR); } + } + else { + if ( ! getpwnam(user) ) + die("user '%s' is not in passwd file. Aborting.", user); + } if ( ! is_allowed(user) ) { die("User '%s' is not allowed to use %s. Aborting.",