[Spice-devel,v2,5/6] red-record-qxl: child_output_setup: remove fcntl call

Submitted by Uri Lublin on Dec. 6, 2016, 4:06 p.m.

Details

Message ID 20161206160631.30624-6-uril@redhat.com
State Accepted
Commit c3d5689f4a0787fc7ed671ea2e3cb68795b440ad
Headers show
Series "More coverity fixes" ( rev: 3 ) in Spice

Not browsing as part of any series.

Commit Message

Uri Lublin Dec. 6, 2016, 4:06 p.m.
man 2 dup2 specifies:
  The close-on-exec flag (FD_CLOEXEC; see  fcntl(2))  for
  the duplicate descriptor is off.

Since the purpose of the fcntl call is to turn off FD_CLOEXEC
flag, and it's already done, just remove this call.

Suggested-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Uri Lublin <uril@redhat.com>
---
 server/red-record-qxl.c | 4 ----
 1 file changed, 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
index 184d6b9..ee22236 100644
--- a/server/red-record-qxl.c
+++ b/server/red-record-qxl.c
@@ -21,7 +21,6 @@ 
 
 #include <stdbool.h>
 #include <inttypes.h>
-#include <fcntl.h>
 #include <glib.h>
 #include "red-common.h"
 #include "memslot.h"
@@ -851,9 +850,6 @@  static void child_output_setup(gpointer user_data)
         continue;
     }
     close(fd);
-
-    // make sure file is not closed calling exec()
-    fcntl(STDOUT_FILENO, F_SETFD, 0);
 }
 
 RedRecord *red_record_new(const char *filename)

Comments

> 
> man 2 dup2 specifies:
>   The close-on-exec flag (FD_CLOEXEC; see  fcntl(2))  for
>   the duplicate descriptor is off.
> 
> Since the purpose of the fcntl call is to turn off FD_CLOEXEC
> flag, and it's already done, just remove this call.
> 
> Suggested-by: Frediano Ziglio <fziglio@redhat.com>
> Signed-off-by: Uri Lublin <uril@redhat.com>
> ---
>  server/red-record-qxl.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
> index 184d6b9..ee22236 100644
> --- a/server/red-record-qxl.c
> +++ b/server/red-record-qxl.c
> @@ -21,7 +21,6 @@
>  
>  #include <stdbool.h>
>  #include <inttypes.h>
> -#include <fcntl.h>
>  #include <glib.h>
>  #include "red-common.h"
>  #include "memslot.h"
> @@ -851,9 +850,6 @@ static void child_output_setup(gpointer user_data)
>          continue;
>      }
>      close(fd);
> -
> -    // make sure file is not closed calling exec()
> -    fcntl(STDOUT_FILENO, F_SETFD, 0);
>  }
>  
>  RedRecord *red_record_new(const char *filename)

Acked-by: Frediano Ziglio <fziglio@redhat.com>

Frediano