shm: Wrap memfd-specific code in relevant ifdef
authorArun Raghavan <arun@arunraghavan.net>
Wed, 10 Aug 2016 16:13:32 +0000 (21:43 +0530)
committerArun Raghavan <arun@arunraghavan.net>
Wed, 10 Aug 2016 16:48:13 +0000 (22:18 +0530)
Doesn't really affect logic, but Coverity reports this as dead-code, and
I figure it makes sense to be consistent about our use of HAVE_MEMFD.

CID: 1352045

src/pulsecore/shm.c

index 9dea0a52afffba3df6a0f8c4121dac0eaa689bcc..8bd7ed78954aa15e226abe8bff9060217f60e559 100644 (file)
@@ -201,12 +201,14 @@ static int sharedmem_create(pa_shm *m, pa_mem_type_t type, size_t size, mode_t m
 
     /* For memfds, we keep the fd open until we pass it
      * to the other PA endpoint over unix domain socket. */
-    if (type == PA_MEM_TYPE_SHARED_MEMFD)
-        m->fd = fd;
-    else {
+    if (type != PA_MEM_TYPE_SHARED_MEMFD) {
         pa_assert_se(pa_close(fd) == 0);
         m->fd = -1;
     }
+#if HAVE_MEMFD
+    else
+        m->fd = fd;
+#endif
 
     return 0;