commit
52bbb4730b
@ -17,7 +17,7 @@ diff -up at-3.1.18/Makefile.in.make at-3.1.18/Makefile.in
|
||||
|
||||
y.tab.c y.tab.h: parsetime.y
|
||||
$(YACC) -d parsetime.y
|
||||
@@ -89,38 +89,41 @@ atrun: atrun.in
|
||||
@@ -92,40 +92,41 @@ atrun: atrun.in
|
||||
configure
|
||||
|
||||
.c.o:
|
||||
@ -28,6 +28,7 @@ diff -up at-3.1.18/Makefile.in.make at-3.1.18/Makefile.in
|
||||
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(etcdir)
|
||||
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(bindir)
|
||||
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(sbindir)
|
||||
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(atdatadir)
|
||||
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(docdir)
|
||||
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(atdocdir)
|
||||
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(IROOT)$(ATSPOOL_DIR) $(IROOT)$(ATJOB_DIR)
|
||||
@ -52,6 +53,7 @@ diff -up at-3.1.18/Makefile.in.make at-3.1.18/Makefile.in
|
||||
$(LN_S) -f at $(IROOT)$(bindir)/atq
|
||||
$(LN_S) -f at $(IROOT)$(bindir)/atrm
|
||||
- $(INSTALL) -g root -o root -m 755 batch $(IROOT)$(bindir)
|
||||
- $(INSTALL) -g root -o root -m 755 batch-job $(IROOT)$(atdatadir)
|
||||
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man1dir)
|
||||
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man5dir)
|
||||
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man8dir)
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
diff -up at-3.1.18/parsetime.y.dst at-3.1.18/parsetime.y
|
||||
--- at-3.1.18/parsetime.y.dst 2015-12-06 16:45:10.000000000 +0100
|
||||
+++ at-3.1.18/parsetime.y 2015-07-01 13:53:14.088881926 +0200
|
||||
@@ -476,8 +476,8 @@ parsetime(time_t currtime, int argc, cha
|
||||
exectm = *localtime(&currtime);
|
||||
currtime -= exectm.tm_sec;
|
||||
exectm.tm_sec = 0;
|
||||
- exectm.tm_isdst = -1;
|
||||
memcpy(&currtm,&exectm,sizeof(currtm));
|
||||
+ exectm.tm_isdst = -1;
|
||||
time_only = 0;
|
||||
yearspec = 0;
|
||||
|
||||
@@ -503,8 +503,8 @@ parsetime(time_t currtime, int argc, cha
|
||||
return 0;
|
||||
if (isgmt) {
|
||||
exectime -= timezone;
|
||||
- if (currtm.tm_isdst && !exectm.tm_isdst)
|
||||
- exectime -= 3600;
|
||||
+ if (exectm.tm_isdst)
|
||||
+ exectime += 3600;
|
||||
}
|
||||
if (exectime < currtime)
|
||||
panic("refusing to create job destined in the past");
|
||||
@ -77,32 +77,35 @@ diff -up at-3.1.20/atd.c.lock-locks at-3.1.20/atd.c
|
||||
unlink(newname);
|
||||
free(newname);
|
||||
|
||||
@@ -723,16 +732,18 @@ run_loop()
|
||||
@@ -732,16 +732,18 @@ run_loop()
|
||||
|
||||
/* Skip lock files */
|
||||
if (queue == '=') {
|
||||
- /* FIXME: calhariz */
|
||||
- /* I think the following code is broken, but commenting
|
||||
- may haven unknow side effects. Make a release and see
|
||||
- /* I think the following code is broken, but commenting it
|
||||
- may cause unknow side effects. Make a release and see
|
||||
- in the wild how it works. For more information see:
|
||||
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818508/*
|
||||
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818508 */
|
||||
-
|
||||
- /* if ((buf.st_nlink == 1) && (run_time + CHECK_INTERVAL <= now)) { */
|
||||
- /* /\* Remove stale lockfile FIXME: lock the lockfile, if you fail, it's still in use. *\/ */
|
||||
- /* unlink(dirent->d_name); */
|
||||
- /* } */
|
||||
+ if ((buf.st_nlink == 1) && (run_time + CHECK_INTERVAL <= now)) {
|
||||
+ if ((buf.st_nlink == 1) && (run_time + CHECK_INTERVAL <= now)) {
|
||||
+ int fd;
|
||||
+
|
||||
+ fd = open(dirent->d_name, O_RDONLY);
|
||||
+ if (fd != -1) {
|
||||
+ if (flock(fd, LOCK_EX | LOCK_NB) == 0) {
|
||||
+ unlink(dirent->d_name);
|
||||
+ syslog(LOG_NOTICE, "removing stale lock file %s\n", dirent->d_name);
|
||||
+ }
|
||||
+ (void)close(fd);
|
||||
+ }
|
||||
+ }
|
||||
+ if (flock(fd, LOCK_EX | LOCK_NB) == 0) {
|
||||
+ unlink(dirent->d_name);
|
||||
+ syslog(LOG_NOTICE, "removing stale lock file %s\n", dirent->d_name);
|
||||
+ }
|
||||
+ (void)close(fd);
|
||||
+ }
|
||||
+ }
|
||||
continue;
|
||||
}
|
||||
/* Skip any other file types which may have been invented in
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
||||
@ -176,13 +176,13 @@ diff -up at-3.1.20/atd.c.pam at-3.1.20/atd.c
|
||||
/* Set up things for the child; we want standard input from the
|
||||
* input file, and standard output and error sent to our output file.
|
||||
*/
|
||||
@@ -492,8 +489,6 @@ run_file(const char *filename, uid_t uid
|
||||
@@ -489,8 +489,6 @@ run_file(const char *filename, uid_t uid, gid_t gid)
|
||||
close(fd_in);
|
||||
close(fd_out);
|
||||
|
||||
- PRIV_START
|
||||
-
|
||||
nice((tolower((int) queue) - 'a' + 1) * 2);
|
||||
nice((tolower((int) queue) - 'a') * 2);
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
@@ -514,9 +509,9 @@ run_file(const char *filename, uid_t uid
|
||||
|
||||
@ -26,7 +26,7 @@ diff -up at-3.1.20/at.c.shell at-3.1.20/at.c
|
||||
|
||||
/* Install the signal handler for SIGINT; terminate after removing the
|
||||
* spool file if necessary
|
||||
@@ -465,6 +468,9 @@ writefile(time_t runtimer, char queue)
|
||||
@@ -483,6 +483,9 @@ writefile(time_t runtimer, char queue)
|
||||
fprintf(fp, " || {\n\t echo 'Execution directory "
|
||||
"inaccessible' >&2\n\t exit 1\n}\n");
|
||||
|
||||
@ -35,7 +35,7 @@ diff -up at-3.1.20/at.c.shell at-3.1.20/at.c
|
||||
+
|
||||
istty = isatty(fileno(stdin));
|
||||
if (istty) {
|
||||
fprintf(stderr, "at> ");
|
||||
runtime = localtime(&runtimer);
|
||||
@@ -480,7 +486,7 @@ writefile(time_t runtimer, char queue)
|
||||
if (istty) {
|
||||
fprintf(stderr, "<EOT>\n");
|
||||
|
||||
115
at-3.1.23-coverity-fix.patch
Normal file
115
at-3.1.23-coverity-fix.patch
Normal file
@ -0,0 +1,115 @@
|
||||
From 4be4813262b3b57a95a5f3ce909d30741aa3ac72 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= <jstanek@redhat.com>
|
||||
Date: Fri, 9 Apr 2021 16:47:33 +0200
|
||||
Subject: [PATCH] Address issues raised by static analysis
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Jan Staněk <jstanek@redhat.com>
|
||||
---
|
||||
at.c | 22 ++++++++++++++++++----
|
||||
daemon.c | 21 ++++++++++++++-------
|
||||
2 files changed, 32 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/at.c b/at.c
|
||||
index df55dc9..0c74e2e 100644
|
||||
--- a/at.c
|
||||
+++ b/at.c
|
||||
@@ -545,17 +545,27 @@ writefile(time_t runtimer, char queue)
|
||||
return;
|
||||
}
|
||||
|
||||
- if (fstat(fd, &statbuf) == -1)
|
||||
+ if (fstat(fd, &statbuf) == -1) {
|
||||
+ close(fd);
|
||||
return;
|
||||
+ }
|
||||
if ((statbuf.st_uid != 0) || !S_ISREG(statbuf.st_mode) ||
|
||||
- (statbuf.st_mode & (S_IWGRP | S_IWOTH)))
|
||||
+ (statbuf.st_mode & (S_IWGRP | S_IWOTH))) {
|
||||
+ close(fd);
|
||||
return;
|
||||
+ }
|
||||
|
||||
fp = fdopen(fd, "r");
|
||||
- if (fp == NULL)
|
||||
+ if (fp == NULL) {
|
||||
+ close(fd);
|
||||
return;
|
||||
- if (fscanf(fp, "%d", &pid) != 1)
|
||||
+ }
|
||||
+ if (fscanf(fp, "%d", &pid) != 1) {
|
||||
+ fclose(fp);
|
||||
return;
|
||||
+ } else {
|
||||
+ fclose(fp);
|
||||
+ }
|
||||
|
||||
kill_errno = 0;
|
||||
|
||||
@@ -640,6 +650,8 @@ list_jobs(void)
|
||||
else
|
||||
printf("%ld\t%s %c\n", jobno, timestr, queue);
|
||||
}
|
||||
+ closedir(spool);
|
||||
+
|
||||
PRIV_END
|
||||
}
|
||||
|
||||
@@ -722,6 +734,8 @@ process_jobs(int argc, char **argv, int what)
|
||||
putchar(ch);
|
||||
}
|
||||
done = 1;
|
||||
+ fclose(fp);
|
||||
+ fp = NULL;
|
||||
}
|
||||
else {
|
||||
perr("Cannot open %.500s", dirent->d_name);
|
||||
diff --git a/daemon.c b/daemon.c
|
||||
index 4003b56..bc8191e 100644
|
||||
--- a/daemon.c
|
||||
+++ b/daemon.c
|
||||
@@ -122,18 +122,23 @@ daemon_setup()
|
||||
/* Set up standard daemon environment */
|
||||
pid_t pid;
|
||||
mode_t old_umask;
|
||||
- int fd;
|
||||
+ int fd, devnull;
|
||||
FILE *fp;
|
||||
|
||||
if (!daemon_debug) {
|
||||
- close(0);
|
||||
- close(1);
|
||||
- close(2);
|
||||
- if ((open("/dev/null", O_RDWR) != 0) ||
|
||||
- (open("/dev/null", O_RDWR) != 1) ||
|
||||
- (open("/dev/null", O_RDWR) != 2)) {
|
||||
+ devnull = open("/dev/null", O_RDWR);
|
||||
+ if (devnull == -1) {
|
||||
perr("Error redirecting I/O");
|
||||
}
|
||||
+
|
||||
+ if ((dup2(devnull, 0) == -1) ||
|
||||
+ (dup2(devnull, 1) == -1) ||
|
||||
+ (dup2(devnull, 2) == -1)) {
|
||||
+ close(devnull);
|
||||
+ perr("Error redirecting I/O");
|
||||
+ } else {
|
||||
+ close(devnull);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (daemon_foreground)
|
||||
@@ -208,6 +213,8 @@ daemon_setup()
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
PRIV_END
|
||||
|
||||
+ /* See the above comment. */
|
||||
+ /* coverity[leaked_storage: FALSE] */
|
||||
return;
|
||||
}
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
||||
18
at.spec
18
at.spec
@ -1,6 +1,6 @@
|
||||
Name: at
|
||||
Version: 3.1.23
|
||||
Release: 5
|
||||
Version: 3.2.2
|
||||
Release: 1
|
||||
Summary: A job manager
|
||||
License: GPLv3+, GPLv2+, ISC, MIT, Public Domain
|
||||
URL: http://ftp.debian.org/debian/pool/main/a/at
|
||||
@ -22,10 +22,10 @@ Patch9: at-3.1.20-aborted-jobs.patch
|
||||
Patch10: at-3.1.18-noabort.patch
|
||||
Patch11: at-3.1.16-fclose-error.patch
|
||||
Patch12: at-3.1.16-clear-nonjobs.patch
|
||||
Patch13: at-3.1.18-utc-dst.patch
|
||||
Patch14: at-3.1.20-lock-locks.patch
|
||||
Patch15: at-3.1.23-document-n.patch
|
||||
Patch16: at-3.1.20-log-jobs.patch
|
||||
Patch13: at-3.1.20-lock-locks.patch
|
||||
Patch14: at-3.1.23-document-n.patch
|
||||
Patch15: at-3.1.20-log-jobs.patch
|
||||
Patch16: at-3.1.23-coverity-fix.patch
|
||||
|
||||
BuildRequires: gcc flex flex-static bison pam-devel smtpdaemon libffi
|
||||
BuildRequires: autoconf libselinux-devel >= 1.27.9 perl(Test::Harness) perl(Test::More)
|
||||
@ -125,6 +125,12 @@ chown root:root %{_localstatedir}/spool/at/.SEQ
|
||||
%{_mandir}/man*/*
|
||||
|
||||
%changelog
|
||||
* Sat Dec 25 2021 yangzhuangzhuang<yangzhuangzhuang1@huawei.com> - 3.2.2-1
|
||||
- Type:update
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:update version to 3.2.2
|
||||
|
||||
* Thu Jan 16 2020 chengquan<chengquan3@huawei.com> - 3.1.23-5
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
Binary file not shown.
BIN
at_3.2.2.orig.tar.gz
Normal file
BIN
at_3.2.2.orig.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user