diff options
author | basabi <none@none> | 2007-12-03 14:32:45 -0800 |
---|---|---|
committer | basabi <none@none> | 2007-12-03 14:32:45 -0800 |
commit | d9f271072c38ba07dd14b0e73464e3b6adca60fa (patch) | |
tree | 878c20408eb165be28420da607aff702a37a0216 /usr/src/cmd/cron | |
parent | 635ad929b1c9dfc0b3e4defaa2738fdbf4fa9725 (diff) | |
download | illumos-gate-d9f271072c38ba07dd14b0e73464e3b6adca60fa.tar.gz |
6636777 *cron* coredumps on NULL home directory
Diffstat (limited to 'usr/src/cmd/cron')
-rw-r--r-- | usr/src/cmd/cron/cron.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr/src/cmd/cron/cron.c b/usr/src/cmd/cron/cron.c index 189d0d4727..75e7106d5e 100644 --- a/usr/src/cmd/cron/cron.c +++ b/usr/src/cmd/cron/cron.c @@ -898,8 +898,13 @@ mod_ctab(char *name, time_t reftime) } else { u->uid = pw->pw_uid; u->gid = pw->pw_gid; - if (strcmp(u->home, pw->pw_dir) != 0) { - free(u->home); + if (u->home != NULL) { + if (strcmp(u->home, pw->pw_dir) != 0) { + free(u->home); + u->home = xmalloc(strlen(pw->pw_dir) + 1); + (void) strcpy(u->home, pw->pw_dir); + } + } else { u->home = xmalloc(strlen(pw->pw_dir) + 1); (void) strcpy(u->home, pw->pw_dir); } |