adding new GNUNET_HELPER_ API for communication with (SUID) helper binaries via stdin...
[oweals/gnunet.git] / src / util / service.c
index d37fe87c21ecae4d5ee96f59d8b3e5aec114efbc..8235830c99dd463274ee765e3d68d47b76cb8278 100644 (file)
@@ -1150,9 +1150,9 @@ receive_sockets_from_parent (struct GNUNET_SERVICE_Context *sctx)
   {
     LOG (GNUNET_ERROR_TYPE_ERROR,
          _("Could not access a pre-bound socket, will try to bind myself\n"));
-    for (i = 0; sctx->lsocks[i] != NULL && i < count; i++)
+    for (i = 0; i < count && sctx->lsocks[i] != NULL; i++)
       GNUNET_break (0 == GNUNET_NETWORK_socket_close (sctx->lsocks[i]));
-    GNUNET_free (sctx->lsocks);
+    GNUNET_free_non_null (sctx->lsocks);
     sctx->lsocks = NULL;
     return GNUNET_NO;
   }
@@ -1351,7 +1351,7 @@ write_pid_file (struct GNUNET_SERVICE_Context *sctx, pid_t pid)
   }
   if (0 > FPRINTF (pidfd, "%u", pid))
     LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fprintf", pif);
-  GNUNET_break (0 == fclose (pidfd));
+  GNUNET_break (0 == FCLOSE (pidfd));
   if ((user != NULL) && (0 < strlen (user)))
     GNUNET_DISK_file_change_owner (pif, user);
   GNUNET_free_non_null (user);