]> granicus.if.org Git - cronie/commitdiff
smatch scan: fix various warningss found using smatch
authorSami Kerola <kerolasa@iki.fi>
Sat, 29 Dec 2012 16:19:15 +0000 (16:19 +0000)
committerTomas Mraz <tmraz@fedoraproject.org>
Thu, 17 Jan 2013 13:06:15 +0000 (14:06 +0100)
entry.c:396 load_entry() info: redundant null check on e->pwd calling free()
entry.c:398 load_entry() info: redundant null check on e->cmd calling free()

/usr/include/bits/fcntl.h:48:10: warning: preprocessor token O_NOFOLLOW redefined
macros.h:136:9: this was the original definition

security.c:98:44: warning: non-ANSI function declaration of function 'cron_restore_default_security_context'
crontab.c:439:29: warning: non-ANSI function declaration of function 'tmp_path'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
src/crontab.c
src/entry.c
src/macros.h
src/security.c

index bfff1827d337c0dba88953841632103e95234804..5703a3bef27340c36bdf87b1b6e10646ed057b58 100644 (file)
@@ -436,7 +436,7 @@ static void check_error(const char *msg) {
        fprintf(stderr, "\"%s\":%d: %s\n", Filename, LineNumber - 1, msg);
 }
 
-static const char *tmp_path() {
+static const char *tmp_path(void) {
        const char *tmpdir = NULL;
 
        if ((getuid() == geteuid()) && (getgid() == getegid())) {
index 0b482b91c6beabc3fb075fa53cbde534ca163af3..e9142f5a6dbffc8a1790457be49b6db3fd9da492 100644 (file)
@@ -392,10 +392,8 @@ entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw,
   eof:
        if (e->envp)
                env_free(e->envp);
-       if (e->pwd)
-               free(e->pwd);
-       if (e->cmd)
-               free(e->cmd);
+       free(e->pwd);
+       free(e->cmd);
        free(e);
        while (ch != '\n' && !feof(file))
                ch = get_char(file);
index 215753a5f3dd23f5afb5c20d8d9508712bc4b04b..6c7ca6db71c582953414b00df0716ccbe8172669 100644 (file)
@@ -25,6 +25,7 @@
 #ifdef HAVE_LIMITS_H
 #include <limits.h>
 #endif
+
        /* these are really immutable, and are
         *   defined for symbolic convenience only
         * TRUE, FALSE, and ERR must be distinct
  * we will just have to live without it.  In order for this to be an
  * issue an attacker would have to subvert group CRON_GROUP.
  */
+#include <fcntl.h>
 #ifndef O_NOFOLLOW
 #define O_NOFOLLOW     0
 #endif
index b483134844eab7bf7f68172d083221e595292042..c5fbc5e40c48252674a8284d653853fb2a289488 100644 (file)
@@ -100,7 +100,7 @@ static int cron_get_job_range(user * u, security_context_t * ucontextp,
        char **jobenv);
 #endif
 
-void cron_restore_default_security_context() {
+void cron_restore_default_security_context(void) {
 #ifdef WITH_SELINUX
        setexeccon(NULL);
 #endif