Build failed due to -Werror option (#32040)
authorKirill Frolov <k.frolov@samsung.com>
Tue, 11 Feb 2020 04:42:15 +0000 (07:42 +0300)
committerGitHub <noreply@github.com>
Tue, 11 Feb 2020 04:42:15 +0000 (20:42 -0800)
* fixed error processing for pipe2 call in Unix/../pal_process.c

Due to -Werror warning (function result not checked) is converted to an
error.

Fix #32038

* fixed warnings in Unix/../pal_networking.c

Due to -Werror all warnings (wrong signess, wrong types) converted to
errors, so why this changes needed.

Fix #32038

src/libraries/Native/Unix/System.Native/pal_networking.c
src/libraries/Native/Unix/System.Native/pal_process.c

index 9b1cd7b824de873eb8e0f35a83bd5c5307eb4100..444aa1ad09a09f93a0a58e08754e65e66e2882a6 100644 (file)
@@ -495,7 +495,7 @@ int32_t SystemNative_GetNameInfo(const uint8_t* address,
                              (uint32_t)hostLength,
                              (char*)service,
                              (uint32_t)serviceLength,
-                             nativeFlags);
+                             (int)nativeFlags);
     }
     else
     {
@@ -508,7 +508,7 @@ int32_t SystemNative_GetNameInfo(const uint8_t* address,
                              (uint32_t)hostLength,
                              (char*)service,
                              (uint32_t)serviceLength,
-                             nativeFlags);
+                             (int)nativeFlags);
     }
 
     return ConvertGetAddrInfoAndGetNameInfoErrorsToPal(result);
@@ -1489,11 +1489,7 @@ int32_t SystemNative_Bind(intptr_t socket, int32_t protocolType, uint8_t* socket
     int err = bind(
         fd,
         (struct sockaddr*)socketAddress,
-#if BIND_ADDRLEN_UNSIGNED
         (socklen_t)socketAddressLen);
-#else
-        socketAddressLen);
-#endif
 
     return err == 0 ? Error_SUCCESS : SystemNative_ConvertErrorPlatformToPal(errno);
 }
index 97795517968ac8c26330875db478563176683bd9..529be7d428c52ecefa49dd2c000bbf9151c25373 100644 (file)
@@ -304,9 +304,9 @@ int32_t SystemNative_ForkAndExecProcess(const char* filename,
     // Process is still the clone of this one. This is a best-effort attempt, so ignore any errors.
     // If the child fails to exec we use the pipe to pass the errno to the parent process.
 #if HAVE_PIPE2
-    pipe2(waitForChildToExecPipe, O_CLOEXEC);
+    (void)! pipe2(waitForChildToExecPipe, O_CLOEXEC);
 #else
-    SystemNative_Pipe(waitForChildToExecPipe, PAL_O_CLOEXEC);
+    (void)! SystemNative_Pipe(waitForChildToExecPipe, PAL_O_CLOEXEC);
 #endif
 
     // The fork child must not be signalled until it calls exec(): our signal handlers do not