rpms/vixie-cron/FC-4 vixie-cron-4.1-CAN-2005-1038-fix-race.patch, NONE, 1.1
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Mon Jul 11 22:17:37 UTC 2005
Author: jvdias
Update of /cvs/dist/rpms/vixie-cron/FC-4
In directory cvs.devel.redhat.com:/tmp/cvs-serv26897
Added Files:
vixie-cron-4.1-CAN-2005-1038-fix-race.patch
Log Message:
fix bug 162887: support crontab remove when multiple /etc/cron.d crontabs
vixie-cron-4.1-CAN-2005-1038-fix-race.patch:
crontab.c | 36 +++++++++++++++++++++---------------
1 files changed, 21 insertions(+), 15 deletions(-)
--- NEW FILE vixie-cron-4.1-CAN-2005-1038-fix-race.patch ---
--- vixie-cron-4.1/crontab.c.CAN-2005-1038-fix-race 2005-07-11 15:23:53.071138000 -0400
+++ vixie-cron-4.1/crontab.c 2005-07-11 17:36:33.841535000 -0400
@@ -488,33 +488,39 @@
(void)signal(SIGHUP, SIG_DFL);
(void)signal(SIGINT, SIG_DFL);
(void)signal(SIGQUIT, SIG_DFL);
+
if (lstat(Filename, &statbuf) < 0) {
- perror("fstat");
+ perror("lstat");
goto fatal;
}
- if (utimebuf.modtime == statbuf.st_mtime) {
- fprintf(stderr, "%s: no changes made to crontab\n",
- ProgramName);
- goto remove;
- }
- if ( (!S_ISREG(statbuf.st_mode))
- ||(S_ISLNK(statbuf.st_mode))
- ||(S_ISDIR(statbuf.st_mode))
- ||(S_ISCHR(statbuf.st_mode))
- ||(S_ISBLK(statbuf.st_mode))
- ||(S_ISFIFO(statbuf.st_mode))
- ||(S_ISSOCK(statbuf.st_mode))
- )
+ if ( !S_ISREG(statbuf.st_mode) )
{
fprintf(stderr, "%s: illegal crontab\n",
ProgramName);
goto remove;
}
+ if (utimebuf.modtime == statbuf.st_mtime) {
+ fprintf(stderr, "%s: no changes made to crontab\n",
+ ProgramName);
+ goto remove;
+ }
+
fprintf(stderr, "%s: installing new crontab\n", ProgramName);
fclose(NewCrontab);
- NewCrontab=fopen(Filename,"r+");
+ if (swap_uids() < OK) {
+ perror("swapping uids");
+ goto remove;
+ }
+ if (!(NewCrontab = fopen(Filename, "r+"))) {
+ perror("cannot read new crontab");
+ goto remove;
+ }
+ if (swap_uids_back() < OK) {
+ perror("swapping uids back");
+ exit(ERROR_EXIT);
+ }
if( NewCrontab == 0L )
{
perror("fopen");
More information about the fedora-cvs-commits
mailing list