diff options
author | gad <gad@FreeBSD.org> | 2001-04-06 02:14:39 +0000 |
---|---|---|
committer | gad <gad@FreeBSD.org> | 2001-04-06 02:14:39 +0000 |
commit | 51f5cfe2c5c104ff536b2bb7252393cb927c0e53 (patch) | |
tree | 61bb9c4547b15a0e401a7deea63b53836c4de494 /usr.sbin/lpr | |
parent | 658db5529ce18698a839ad50c61a9fd0109691ca (diff) | |
download | FreeBSD-src-51f5cfe2c5c104ff536b2bb7252393cb927c0e53.zip FreeBSD-src-51f5cfe2c5c104ff536b2bb7252393cb927c0e53.tar.gz |
Make sure the euid is restored in an obscure error situation.
Submitted by: J Wunsch <j@ida.interface-business.de> in freebsd-audit
Diffstat (limited to 'usr.sbin/lpr')
-rw-r--r-- | usr.sbin/lpr/common_source/common.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c index 07e9bd4..e693e15 100644 --- a/usr.sbin/lpr/common_source/common.c +++ b/usr.sbin/lpr/common_source/common.c @@ -115,7 +115,7 @@ getq(pp, namelist) register int nitems; struct stat stbuf; DIR *dirp; - int arraysz; + int arraysz, statres; seteuid(euid); if ((dirp = opendir(pp->spool_dir)) == NULL) { @@ -140,9 +140,10 @@ getq(pp, namelist) if (d->d_name[0] != 'c' || d->d_name[1] != 'f') continue; /* daemon control files only */ seteuid(euid); - if (stat(d->d_name, &stbuf) < 0) - continue; /* Doesn't exist */ + statres = stat(d->d_name, &stbuf); seteuid(uid); + if (statres < 0) + continue; /* Doesn't exist */ q = (struct jobqueue *)malloc(sizeof(time_t) + strlen(d->d_name) + 1); if (q == NULL) |