From: thib Date: Wed, 4 Jul 2001 16:15:36 +0000 (+0000) Subject: we now use Set() macro X-Git-Tag: ver1564~231 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c30c7eca1fc53f93c86ddc880a4a59937c10d839;p=fcron we now use Set() macro --- diff --git a/conf.c b/conf.c index 0ca2ab8..fba63d6 100644 --- 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 diff --git a/fcrontab.c b/fcrontab.c index df72dd9..907fbc2 100644 --- a/fcrontab.c +++ b/fcrontab.c @@ -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) diff --git a/fileconf.c b/fileconf.c index bbeb072..56331e5 100644 --- a/fileconf.c +++ b/fileconf.c @@ -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); }