GNU bug report logs - #33287
[PATCH] sync: add missing brackets in sync_arg()

Previous Next

Package: coreutils;

Reported by: Kamil Dudka <kdudka <at> redhat.com>

Date: Tue, 6 Nov 2018 12:04:01 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Kamil Dudka <kdudka <at> redhat.com>
Subject: bug#33287: closed (Re: bug#33287: [PATCH] sync: add missing
 brackets in sync_arg())
Date: Tue, 06 Nov 2018 18:37:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#33287: [PATCH] sync: add missing brackets in sync_arg()

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 33287 <at> debbugs.gnu.org.

-- 
33287: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33287
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Kamil Dudka <kdudka <at> redhat.com>, 33287-done <at> debbugs.gnu.org
Subject: Re: bug#33287: [PATCH] sync: add missing brackets in sync_arg()
Date: Tue, 6 Nov 2018 10:35:58 -0800
Thanks, I installed that and am closing the bug report.

[Message part 3 (message/rfc822, inline)]
From: Kamil Dudka <kdudka <at> redhat.com>
To: bug-coreutils <at> gnu.org
Subject: [PATCH] sync: add missing brackets in sync_arg()
Date: Tue,  6 Nov 2018 13:02:24 +0100
Detected by Coverity Analysis:

Error: RESOURCE_LEAK (CWE-772):
coreutils-8.30/src/sync.c:112: open_fn: Returning handle opened by "open".
coreutils-8.30/src/sync.c:112: var_assign: Assigning: "fd" = handle returned from "open(file, 2049)".
coreutils-8.30/src/sync.c:115: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
113|         if (fd < 0)
114|           error (0, rd_errno, _("error opening %s"), quoteaf (file));
115|->       return false;
116|       }
117|
---
 src/sync.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index bd3671a19..607fa8f7f 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -111,8 +111,10 @@ sync_arg (enum sync_mode mode, char const *file)
       if (open_flags != (O_WRONLY | O_NONBLOCK))
         fd = open (file, O_WRONLY | O_NONBLOCK);
       if (fd < 0)
-        error (0, rd_errno, _("error opening %s"), quoteaf (file));
-      return false;
+        {
+          error (0, rd_errno, _("error opening %s"), quoteaf (file));
+          return false;
+        }
     }
 
   /* We used O_NONBLOCK above to not hang with fifos,
-- 
2.17.2




This bug report was last modified 6 years and 282 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.