summaryrefslogtreecommitdiff
path: root/usr.bin/at/at.c
diff options
context:
space:
mode:
authorRobert Nagy <robert@cvs.openbsd.org>2006-03-22 21:51:40 +0000
committerRobert Nagy <robert@cvs.openbsd.org>2006-03-22 21:51:40 +0000
commitce88d7d9b18c336d7246a1b8e928ad345de220be (patch)
tree67afff7b046b9596ed3457b60b7046b044906271 /usr.bin/at/at.c
parenta5577ebcfa9cb6ae8fc02e871ac8770a9ba45104 (diff)
plug an fd leak and closedir() two directories;
ok otto@
Diffstat (limited to 'usr.bin/at/at.c')
-rw-r--r--usr.bin/at/at.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
index a9308405e24..f6616d4cdc6 100644
--- a/usr.bin/at/at.c
+++ b/usr.bin/at/at.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: at.c,v 1.44 2005/10/25 15:49:38 jmc Exp $ */
+/* $OpenBSD: at.c,v 1.45 2006/03/22 21:51:39 robert Exp $ */
/*
* at.c : Put file into atrun queue
@@ -42,7 +42,7 @@
#define TIMESIZE 50 /* Size of buffer passed to strftime() */
#ifndef lint
-static const char rcsid[] = "$OpenBSD: at.c,v 1.44 2005/10/25 15:49:38 jmc Exp $";
+static const char rcsid[] = "$OpenBSD: at.c,v 1.45 2006/03/22 21:51:39 robert Exp $";
#endif
/* Variables to remove from the job's environment. */
@@ -588,6 +588,7 @@ list_jobs(int argc, char **argv, int count_only, int csort)
atjobs[numjobs++] = job;
}
free(uids);
+ closedir(spool);
if (count_only || numjobs == 0) {
if (numjobs == 0 && !shortformat)
@@ -757,6 +758,7 @@ process_jobs(int argc, char **argv, int what)
while ((ch = getc(fp)) != EOF)
putchar(ch);
+ fclose(fp);
break;
default:
@@ -765,6 +767,8 @@ process_jobs(int argc, char **argv, int what)
}
}
}
+ closedir(spool);
+
for (error = 0, i = 0; i < jobs_len; i++) {
if (jobs[i] != NULL) {
if (!force)