[systemd-devel] [PATCH] Fix a few compiler warnings

Cristian Rodríguez crrodriguez at opensuse.org
Sun May 18 13:30:28 PDT 2014


---
 src/journal/test-journal-stream.c  | 2 +-
 src/libsystemd/sd-login/sd-login.c | 2 +-
 src/shared/util.c                  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/journal/test-journal-stream.c b/src/journal/test-journal-stream.c
index 8e1d08d..4f56edb 100644
--- a/src/journal/test-journal-stream.c
+++ b/src/journal/test-journal-stream.c
@@ -41,7 +41,7 @@ static void verify_contents(sd_journal *j, unsigned skip) {
                 const void *d;
                 char *k, *c;
                 size_t l;
-                unsigned u;
+                unsigned u = 0;
 
                 assert_se(sd_journal_get_cursor(j, &k) >= 0);
                 printf("cursor: %s\n", k);
diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c
index e7eea19..583095d 100644
--- a/src/libsystemd/sd-login/sd-login.c
+++ b/src/libsystemd/sd-login/sd-login.c
@@ -82,7 +82,7 @@ _public_ int sd_pid_get_owner_uid(pid_t pid, uid_t *uid) {
 }
 
 _public_ int sd_peer_get_session(int fd, char **session) {
-        struct ucred ucred;
+        struct ucred ucred = {};
         int r;
 
         assert_return(fd >= 0, -EINVAL);
diff --git a/src/shared/util.c b/src/shared/util.c
index 0cc51e0..7d440af 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4324,7 +4324,7 @@ char* gid_to_name(gid_t gid) {
 
 int get_group_creds(const char **groupname, gid_t *gid) {
         struct group *g;
-        gid_t id;
+        gid_t id = 0;
 
         assert(groupname);
 
@@ -6093,7 +6093,7 @@ int container_get_leader(const char *machine, pid_t *pid) {
 
 int namespace_open(pid_t pid, int *pidns_fd, int *mntns_fd, int *netns_fd, int *root_fd) {
         _cleanup_close_ int pidnsfd = -1, mntnsfd = -1, netnsfd = -1;
-        int rfd;
+        int rfd = -1;
 
         assert(pid >= 0);
 
-- 
1.8.4.5



More information about the systemd-devel mailing list