diff options
-rw-r--r-- | src/util/configuration.c | 3 | ||||
-rw-r--r-- | src/util/disk.c | 20 | ||||
-rw-r--r-- | src/util/network.c | 11 | ||||
-rw-r--r-- | src/util/service.c | 11 |
4 files changed, 25 insertions, 20 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c index 9b68513af..3e6710543 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -346,7 +346,8 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
346 | if (fs != GNUNET_DISK_fn_read (fn, mem, fs)) | 346 | if (fs != GNUNET_DISK_fn_read (fn, mem, fs)) |
347 | { | 347 | { |
348 | LOG (GNUNET_ERROR_TYPE_WARNING, | 348 | LOG (GNUNET_ERROR_TYPE_WARNING, |
349 | "Error while reading file %s\n", fn); | 349 | "Error while reading file %s\n", |
350 | fn); | ||
350 | GNUNET_free (fn); | 351 | GNUNET_free (fn); |
351 | GNUNET_free (mem); | 352 | GNUNET_free (mem); |
352 | return GNUNET_SYSERR; | 353 | return GNUNET_SYSERR; |
diff --git a/src/util/disk.c b/src/util/disk.c index c5a1b82c7..063ffc946 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -939,7 +939,9 @@ GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle *h, | |||
939 | return GNUNET_SYSERR; | 939 | return GNUNET_SYSERR; |
940 | } | 940 | } |
941 | } | 941 | } |
942 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Read %u bytes\n", bytes_read); | 942 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
943 | "Read %u bytes\n", | ||
944 | bytes_read); | ||
943 | } | 945 | } |
944 | else | 946 | else |
945 | { | 947 | { |
@@ -982,8 +984,10 @@ GNUNET_DISK_fn_read (const char *fn, | |||
982 | struct GNUNET_DISK_FileHandle *fh; | 984 | struct GNUNET_DISK_FileHandle *fh; |
983 | ssize_t ret; | 985 | ssize_t ret; |
984 | 986 | ||
985 | fh = GNUNET_DISK_file_open (fn, GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_NONE); | 987 | fh = GNUNET_DISK_file_open (fn, |
986 | if (!fh) | 988 | GNUNET_DISK_OPEN_READ, |
989 | GNUNET_DISK_PERM_NONE); | ||
990 | if (NULL == fh) | ||
987 | return GNUNET_SYSERR; | 991 | return GNUNET_SYSERR; |
988 | ret = GNUNET_DISK_file_read (fh, result, len); | 992 | ret = GNUNET_DISK_file_read (fh, result, len); |
989 | GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh)); | 993 | GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh)); |
@@ -1196,7 +1200,7 @@ GNUNET_DISK_directory_scan (const char *dir_name, | |||
1196 | unsigned int name_len; | 1200 | unsigned int name_len; |
1197 | unsigned int n_size; | 1201 | unsigned int n_size; |
1198 | 1202 | ||
1199 | GNUNET_assert (dir_name != NULL); | 1203 | GNUNET_assert (NULL != dir_name); |
1200 | dname = GNUNET_STRINGS_filename_expand (dir_name); | 1204 | dname = GNUNET_STRINGS_filename_expand (dir_name); |
1201 | if (dname == NULL) | 1205 | if (dname == NULL) |
1202 | return GNUNET_SYSERR; | 1206 | return GNUNET_SYSERR; |
@@ -1208,7 +1212,7 @@ GNUNET_DISK_directory_scan (const char *dir_name, | |||
1208 | GNUNET_free (dname); | 1212 | GNUNET_free (dname); |
1209 | return GNUNET_SYSERR; | 1213 | return GNUNET_SYSERR; |
1210 | } | 1214 | } |
1211 | if (!S_ISDIR (istat.st_mode)) | 1215 | if (! S_ISDIR (istat.st_mode)) |
1212 | { | 1216 | { |
1213 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1217 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1214 | _("Expected `%s' to be a directory!\n"), | 1218 | _("Expected `%s' to be a directory!\n"), |
@@ -1218,7 +1222,7 @@ GNUNET_DISK_directory_scan (const char *dir_name, | |||
1218 | } | 1222 | } |
1219 | errno = 0; | 1223 | errno = 0; |
1220 | dinfo = OPENDIR (dname); | 1224 | dinfo = OPENDIR (dname); |
1221 | if ((errno == EACCES) || (dinfo == NULL)) | 1225 | if ((errno == EACCES) || (NULL == dinfo)) |
1222 | { | 1226 | { |
1223 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "opendir", dname); | 1227 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "opendir", dname); |
1224 | if (dinfo != NULL) | 1228 | if (dinfo != NULL) |
@@ -1229,12 +1233,12 @@ GNUNET_DISK_directory_scan (const char *dir_name, | |||
1229 | name_len = 256; | 1233 | name_len = 256; |
1230 | n_size = strlen (dname) + name_len + 2; | 1234 | n_size = strlen (dname) + name_len + 2; |
1231 | name = GNUNET_malloc (n_size); | 1235 | name = GNUNET_malloc (n_size); |
1232 | while ((finfo = READDIR (dinfo)) != NULL) | 1236 | while (NULL != (finfo = READDIR (dinfo))) |
1233 | { | 1237 | { |
1234 | if ((0 == strcmp (finfo->d_name, ".")) || | 1238 | if ((0 == strcmp (finfo->d_name, ".")) || |
1235 | (0 == strcmp (finfo->d_name, ".."))) | 1239 | (0 == strcmp (finfo->d_name, ".."))) |
1236 | continue; | 1240 | continue; |
1237 | if (callback != NULL) | 1241 | if (NULL != callback) |
1238 | { | 1242 | { |
1239 | if (name_len < strlen (finfo->d_name)) | 1243 | if (name_len < strlen (finfo->d_name)) |
1240 | { | 1244 | { |
diff --git a/src/util/network.c b/src/util/network.c index 968870def..79c25c4d0 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -931,14 +931,13 @@ GNUNET_NETWORK_socket_create (int domain, | |||
931 | int protocol) | 931 | int protocol) |
932 | { | 932 | { |
933 | struct GNUNET_NETWORK_Handle *ret; | 933 | struct GNUNET_NETWORK_Handle *ret; |
934 | int fd; | ||
934 | 935 | ||
935 | ret = GNUNET_new (struct GNUNET_NETWORK_Handle); | 936 | fd = socket (domain, type, protocol); |
936 | ret->fd = socket (domain, type, protocol); | 937 | if (-1 == fd) |
937 | if (-1 == ret->fd) | ||
938 | { | ||
939 | GNUNET_free (ret); | ||
940 | return NULL; | 938 | return NULL; |
941 | } | 939 | ret = GNUNET_new (struct GNUNET_NETWORK_Handle); |
940 | ret->fd = fd; | ||
942 | if (GNUNET_OK != | 941 | if (GNUNET_OK != |
943 | initialize_network_handle (ret, | 942 | initialize_network_handle (ret, |
944 | domain, | 943 | domain, |
diff --git a/src/util/service.c b/src/util/service.c index d49ad4f2a..1f8532211 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -549,7 +549,7 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name, | |||
549 | else | 549 | else |
550 | disablev6 = GNUNET_NO; | 550 | disablev6 = GNUNET_NO; |
551 | 551 | ||
552 | if (!disablev6) | 552 | if (! disablev6) |
553 | { | 553 | { |
554 | /* probe IPv6 support */ | 554 | /* probe IPv6 support */ |
555 | desc = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0); | 555 | desc = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0); |
@@ -562,8 +562,7 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name, | |||
562 | return GNUNET_SYSERR; | 562 | return GNUNET_SYSERR; |
563 | } | 563 | } |
564 | LOG (GNUNET_ERROR_TYPE_INFO, | 564 | LOG (GNUNET_ERROR_TYPE_INFO, |
565 | _ | 565 | _("Disabling IPv6 support for service `%s', failed to create IPv6 socket: %s\n"), |
566 | ("Disabling IPv6 support for service `%s', failed to create IPv6 socket: %s\n"), | ||
567 | service_name, STRERROR (errno)); | 566 | service_name, STRERROR (errno)); |
568 | disablev6 = GNUNET_YES; | 567 | disablev6 = GNUNET_YES; |
569 | } | 568 | } |
@@ -623,7 +622,8 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name, | |||
623 | (unsigned long long) sizeof (s_un.sun_path)); | 622 | (unsigned long long) sizeof (s_un.sun_path)); |
624 | unixpath = GNUNET_NETWORK_shorten_unixpath (unixpath); | 623 | unixpath = GNUNET_NETWORK_shorten_unixpath (unixpath); |
625 | LOG (GNUNET_ERROR_TYPE_INFO, | 624 | LOG (GNUNET_ERROR_TYPE_INFO, |
626 | _("Using `%s' instead\n"), unixpath); | 625 | _("Using `%s' instead\n"), |
626 | unixpath); | ||
627 | } | 627 | } |
628 | #ifdef LINUX | 628 | #ifdef LINUX |
629 | abstract = GNUNET_CONFIGURATION_get_value_yesno (cfg, | 629 | abstract = GNUNET_CONFIGURATION_get_value_yesno (cfg, |
@@ -654,7 +654,8 @@ GNUNET_SERVICE_get_server_addresses (const char *service_name, | |||
654 | } | 654 | } |
655 | LOG (GNUNET_ERROR_TYPE_INFO, | 655 | LOG (GNUNET_ERROR_TYPE_INFO, |
656 | _("Disabling UNIX domain socket support for service `%s', failed to create UNIX domain socket: %s\n"), | 656 | _("Disabling UNIX domain socket support for service `%s', failed to create UNIX domain socket: %s\n"), |
657 | service_name, STRERROR (errno)); | 657 | service_name, |
658 | STRERROR (errno)); | ||
658 | GNUNET_free (unixpath); | 659 | GNUNET_free (unixpath); |
659 | unixpath = NULL; | 660 | unixpath = NULL; |
660 | } | 661 | } |