diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-18 14:30:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-18 14:30:23 +0000 |
commit | 0ea8e006d5f5ef84e31e000607bd24a23f8fc1ed (patch) | |
tree | 9b36e245d428fd641512eb1e1ff86b2a83adf2c2 /src/util/os_installation.c | |
parent | 200aaa0dd6813f19eb7ed67a0fdc301d091fc2d7 (diff) | |
download | gnunet-0ea8e006d5f5ef84e31e000607bd24a23f8fc1ed.tar.gz gnunet-0ea8e006d5f5ef84e31e000607bd24a23f8fc1ed.zip |
code clean up
Diffstat (limited to 'src/util/os_installation.c')
-rw-r--r-- | src/util/os_installation.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index c61028187..19469e81e 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -96,11 +96,12 @@ get_path_from_proc_exe () | |||
96 | GNUNET_snprintf (fn, | 96 | GNUNET_snprintf (fn, |
97 | sizeof(fn), "/proc/%u/exe", getpid ()); | 97 | sizeof(fn), "/proc/%u/exe", getpid ()); |
98 | size = readlink (fn, lnk, sizeof (lnk)-1); | 98 | size = readlink (fn, lnk, sizeof (lnk)-1); |
99 | if ((size == 0) || (size >= sizeof(lnk)-1)) | 99 | if (size <= 0) |
100 | { | 100 | { |
101 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "readlink", fn); | 101 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "readlink", fn); |
102 | return NULL; | 102 | return NULL; |
103 | } | 103 | } |
104 | GNUNET_assert (size < sizeof (lnk)); | ||
104 | lnk[size] = '\0'; | 105 | lnk[size] = '\0'; |
105 | while ((lnk[size] != '/') && (size > 0)) | 106 | while ((lnk[size] != '/') && (size > 0)) |
106 | size--; | 107 | size--; |