From: Vadim Kochan <[email protected]>

In the previous version there was no panic if
file does not exist, so lets follow this behaviour.

Fixes: 96d822d2c0ef (sock: Use sysctl helpers to access /proc/sys/ params)
Signed-off-by: Vadim Kochan <[email protected]>
---
 sock.c   | 2 +-
 sysctl.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sock.c b/sock.c
index 84723d0..e823800 100644
--- a/sock.c
+++ b/sock.c
@@ -168,7 +168,7 @@ static int get_system_socket_mem(int which)
 
 static void set_system_socket_mem(int which, int val)
 {
-       if (sysctl_set_int(sock_mem[which], val))
+       if (sysctl_set_int(sock_mem[which], val) > 0)
                panic("Cannot set system socket memory!\n");
 }
 
diff --git a/sysctl.c b/sysctl.c
index 283d403..822f3c5 100644
--- a/sysctl.c
+++ b/sysctl.c
@@ -31,13 +31,13 @@ int sysctl_set_int(const char *file, int value)
        ret = snprintf(str, 63, "%d", value);
        if (ret < 0) {
                close(fd);
-               return -1;
+               return 1;
        }
 
        ret = write(fd, str, strlen(str));
 
        close(fd);
-       return ret <= 0 ? -1 : 0;
+       return ret <= 0 ? 2 : 0;
 }
 
 int sysctl_get_int(const char *file, int *value)
-- 
2.4.2

-- 
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to