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(a)iki.fi>
---
src/crontab.c | 2 +-
src/entry.c | 6 ++----
src/macros.h | 2 ++
src/security.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/crontab.c b/src/crontab.c
index bfff182..5703a3b 100644
--- a/src/crontab.c
+++ b/src/crontab.c
@@ -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())) {
diff --git a/src/entry.c b/src/entry.c
index 0b482b9..e9142f5 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -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);
diff --git a/src/macros.h b/src/macros.h
index 215753a..6c7ca6d 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -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
@@ -131,6 +132,7 @@
* 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
diff --git a/src/security.c b/src/security.c
index b483134..c5fbc5e 100644
--- a/src/security.c
+++ b/src/security.c
@@ -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
--
1.8.1.1