daemon: Constify argument of two functions.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 21 Jun 2016 21:27:54 +0000 (23:27 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 3 Jul 2016 13:57:16 +0000 (15:57 +0200)
daemon_set_logfile() and daemon_set_loglevel() do not modify the
passed string, so the type of the argument should be const char *.

daemon.c
daemon.h

index 5a92451a4d0621f5c1abb8c8961a878132e8f4e3..945c5a39a094e8314c5667f57f0b6a8099b12b45 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -122,7 +122,7 @@ void daemon_init_colors_or_die(int color_arg, int color_arg_auto,
  *
  * \param logfile_name The full path of the logfile.
  */
-void daemon_set_logfile(char *logfile_name)
+void daemon_set_logfile(const char *logfile_name)
 {
        free(me->logfile_name);
        me->logfile_name = NULL;
@@ -135,7 +135,7 @@ void daemon_set_logfile(char *logfile_name)
  *
  * \param loglevel The smallest level that should be logged.
  */
-void daemon_set_loglevel(char *loglevel)
+void daemon_set_loglevel(const char *loglevel)
 {
        int ret = get_loglevel_by_name(loglevel);
 
index 621420a4340c75fc3eddbe37652c066c0772b8eb..e97678d660c12cf9a3ae1415c38fb0ae55b5ee5d 100644 (file)
--- a/daemon.h
+++ b/daemon.h
@@ -10,9 +10,9 @@ void daemon_drop_privileges_or_die(const char *username, const char *groupname);
 void daemon_set_start_time(void);
 time_t daemon_get_uptime(const struct timeval *current_time);
 __malloc char *daemon_get_uptime_str(const struct timeval *current_time);
-void daemon_set_logfile(char *logfile_name);
+void daemon_set_logfile(const char *logfile_name);
 void daemon_set_flag(unsigned flag);
-void daemon_set_loglevel(char *loglevel);
+void daemon_set_loglevel(const char *loglevel);
 void daemon_init_colors_or_die(int color_arg, int color_arg_auto,
                int color_arg_no, bool logfile_given, char **log_color_argv,
                int argc);