diff --git a/usr.sbin/cron/cron/do_command.c b/usr.sbin/cron/cron/do_command.c index 1e65b4189830..cc19f4a774fb 100644 --- a/usr.sbin/cron/cron/do_command.c +++ b/usr.sbin/cron/cron/do_command.c @@ -251,6 +251,8 @@ child_process(e, u) setuid(e->uid); /* we aren't root after this..*/ #if defined(LOGIN_CAP) } + if (lc != NULL) + login_close(lc); #endif chdir(env_get("HOME", e->envp)); diff --git a/usr.sbin/cron/cron/popen.c b/usr.sbin/cron/cron/popen.c index 56f85e71d479..1ac775dd0d50 100644 --- a/usr.sbin/cron/cron/popen.c +++ b/usr.sbin/cron/cron/popen.c @@ -182,6 +182,8 @@ cron_popen(program, type, e) setuid(e->uid); /* we aren't root after this..*/ #if defined(LOGIN_CAP) } + if (lc != NULL) + login_close(lc); #endif chdir(env_get("HOME", e->envp)); }