chiark / gitweb /
socket-util: library calls shouldn't log on their own
authorLennart Poettering <lennart@poettering.net>
Wed, 29 Jul 2015 10:33:44 +0000 (12:33 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:07:20 +0000 (10:07 +0100)
Instead, make sure that all callers log properly.

src/shared/socket-util.c

index e8bb10d..62f99b3 100644 (file)
@@ -662,13 +662,13 @@ int socknameinfo_pretty(union sockaddr_union *sa, socklen_t salen, char **_ret)
 
                 r = sockaddr_pretty(&sa->sa, salen, true, true, &ret);
                 if (r < 0)
-                        return log_error_errno(r, "sockadd_pretty() failed: %m");
+                        return r;
 
                 log_debug_errno(saved_errno, "getnameinfo(%s) failed: %m", ret);
         } else {
                 ret = strdup(host);
                 if (!ret)
-                        return log_oom();
+                        return -ENOMEM;
         }
 
         *_ret = ret;
@@ -683,7 +683,7 @@ int getnameinfo_pretty(int fd, char **ret) {
         assert(ret);
 
         if (getsockname(fd, &sa.sa, &salen) < 0)
-                return log_error_errno(errno, "getsockname(%d) failed: %m", fd);
+                return -errno;
 
         return socknameinfo_pretty(&sa, salen, ret);
 }