]> granicus.if.org Git - fcron/commitdiff
we now use Set() macro
authorthib <thib>
Wed, 4 Jul 2001 16:15:36 +0000 (16:15 +0000)
committerthib <thib>
Wed, 4 Jul 2001 16:15:36 +0000 (16:15 +0000)
conf.c
fcrontab.c
fileconf.c

diff --git a/conf.c b/conf.c
index 0ca2ab8f9e607f93d0b409a91b068089276b6192..fba63d6d186433db6a72aae0ddd2d2fad70062d0 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -22,7 +22,7 @@
  *  `LICENSE' that comes with the fcron source distribution.
  */
 
- /* $Id: conf.c,v 1.46 2001-06-22 21:09:00 thib Exp $ */
+ /* $Id: conf.c,v 1.47 2001-07-04 16:16:08 thib Exp $ */
 
 #include "fcron.h"
 #include "conf.h"
@@ -626,8 +626,7 @@ read_file(const char *file_name, CF *cf)
                if (strcmp(cl->cl_runas, runas_str) != 0)
                    warn("warning: runas(%s) is not owner (%s): overridden.",
                         cl->cl_runas, runas_str);
-               free(cl->cl_runas);
-               cl->cl_runas = strdup2(runas_str);
+               Set(cl->cl_runas, runas_str);
            }
            
            /* we need that here because the user's name contained in the
index df72dd912de3fa0d4059145c097b8d8441432870..907fbc2baa72e14ece8ce88bb40875dd1c0f9a8a 100644 (file)
@@ -22,7 +22,7 @@
  *  `LICENSE' that comes with the fcron source distribution.
  */
 
- /* $Id: fcrontab.c,v 1.39 2001-06-22 21:06:37 thib Exp $ */
+ /* $Id: fcrontab.c,v 1.40 2001-07-04 16:15:36 thib Exp $ */
 
 /* 
  * The goal of this program is simple : giving a user interface to fcron
@@ -42,7 +42,7 @@
 
 #include "fcrontab.h"
 
-char rcs_info[] = "$Id: fcrontab.c,v 1.39 2001-06-22 21:06:37 thib Exp $";
+char rcs_info[] = "$Id: fcrontab.c,v 1.40 2001-07-04 16:15:36 thib Exp $";
 
 void info(void);
 void usage(void);
@@ -826,8 +826,7 @@ parseopt(int argc, char *argv[])
            fprintf(stderr, "must be privileged to use -u\n");
            xexit(EXIT_ERR);
        }
-       free(user);
-       user = strdup2(argv[optind]) ; 
+       Set(user, argv[optind]); 
     }
     else if (argc - optind == 1) {
        if ( list_opt + rm_opt + edit_opt + reinstall_opt == 0 )
@@ -837,8 +836,7 @@ parseopt(int argc, char *argv[])
                fprintf(stderr, "must be privileged to use [user|-u user]\n");
                xexit(EXIT_ERR);
            }
-           free(user);
-           user = strdup2(argv[optind]);           
+           Set(user, argv[optind]);        
        }
     }
     else if (list_opt + rm_opt + edit_opt + reinstall_opt != 1)
index bbeb0720008de985aa00516cd3eff5eefd6388ac..56331e598a9907b22b01e5072d277956958a1652 100644 (file)
@@ -22,7 +22,7 @@
  *  `LICENSE' that comes with the fcron source distribution.
  */
 
- /* $Id: fileconf.c,v 1.48 2001-06-22 21:08:18 thib Exp $ */
+ /* $Id: fileconf.c,v 1.49 2001-07-04 16:15:54 thib Exp $ */
 
 #include "fcrontab.h"
 #include "fileconf.h"
@@ -333,8 +333,7 @@ read_env(char *ptr, CF *cf)
                        " ignored\n", file_name, line, val);    
                need_correction = 1;
            } else {
-               free(default_line.cl_mailto);
-               default_line.cl_mailto = strdup2(val);
+               Set(default_line.cl_mailto, val);
                set_mail(default_line.cl_option);
            }
        }
@@ -549,10 +548,8 @@ read_opt(char *ptr, CL *cl)
                Handle_err;
            if ( i == 1 ) {
                bzero(cl, sizeof(CL));
-               free(cl->cl_runas);
-               cl->cl_runas = strdup2(user);
-               free(cl->cl_mailto);
-               cl->cl_mailto = strdup2(user);
+               Set(cl->cl_runas, user);
+               Set(cl->cl_mailto, user);
                set_default_opt(cl->cl_option);
            }
            if (debug_opt)
@@ -830,8 +827,7 @@ read_opt(char *ptr, CL *cl)
                            " ignored\n", file_name, line, buf);        
                    need_correction = 1;
                } else {
-                   free(cl->cl_mailto);
-                   cl->cl_mailto = strdup2(buf);
+                   Set(cl->cl_mailto, buf);
                    set_mail(cl->cl_option);
                }
            }
@@ -909,8 +905,7 @@ read_opt(char *ptr, CL *cl)
                    need_correction = 1;
                } 
                else {
-                   free(cl->cl_runas);
-                   cl->cl_runas = strdup2(name);
+                   Set(cl->cl_runas, name);
                    if (debug_opt)
                        fprintf(stderr, "  Opt : \"%s\" %s\n", opt_name, name);
                }
@@ -1016,8 +1011,7 @@ check_username(char *ptr, CF *cf, CL *cl)
            fprintf(stderr, "must be privileged to run as another user : "
                    "ignoring\n");
        } else {
-           free(cl->cl_runas);
-            cl->cl_runas = strdup2(username);
+           Set(cl->cl_runas, username);
             if (debug_opt)
                fprintf(stderr, "  Opt : inline_runas %s\n", username);
        }