]> granicus.if.org Git - cronie/commitdiff
Crontab is stat instead of fstat and crontab is reopened for
authormmaslano <mmaslano@redhat.com>
Fri, 17 Aug 2007 13:00:52 +0000 (15:00 +0200)
committermmaslano <mmaslano@redhat.com>
Fri, 24 Aug 2007 12:53:17 +0000 (14:53 +0200)
reading new stdin.
This change should:
Allowed editors such as 'gedit' which do not modify original
file, but which rename(2) a temp file to original, to be used
by crontab -e (bug 129170).

crontab.c

index 6b3ab1060f4f138c9688fe0eba5248cdf7e922d9..b18601a395b7d9f519cb0723fa86a6301d89388d 100644 (file)
--- a/crontab.c
+++ b/crontab.c
@@ -502,8 +502,8 @@ edit_cmd(void) {
        }
        (void)signal(SIGHUP, SIG_DFL);
        (void)signal(SIGINT, SIG_DFL);
-       (void)signal(SIGQUIT, SIG_DFL);
-       if (fstat(t, &statbuf) < 0) {
+       (void)signal(SIGQUIT, SIG_DFL);      
+       if (stat(Filename, &statbuf) < 0) {
                perror("fstat");
                goto fatal;
        }
@@ -513,6 +513,13 @@ edit_cmd(void) {
                goto remove;
        }
        fprintf(stderr, "%s: installing new crontab\n", ProgramName);
+        fclose(NewCrontab);
+       NewCrontab=fopen(Filename,"r+");
+       if( NewCrontab == 0L )
+       {
+           perror("fopen");
+           goto fatal;
+       }
        switch (replace_cmd()) {
        case 0:
                break;