bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] chcon, chmod, chgrp, chown, du: do not ignore fts_close fail


From: Jim Meyering
Subject: Re: [PATCH] chcon, chmod, chgrp, chown, du: do not ignore fts_close failure
Date: Tue, 01 Sep 2009 13:05:57 +0200

Pádraig Brady wrote:

> Jim Meyering wrote:
>> The following patch will be required when coreutils
>> next updates from gnulib, with gnulib's just-added warn_unused_result
>> attribute on fts_close.
>>
>> It eliminates a slight risk that fts_close would fail and these
>> applications would ignore that failure and exit successfully.
>
> Do we want to fail silently though (however unlikely)?
> I.E. do these need: error (0, errno, _("fts_close failed"));

Thanks again.
I'll wait for your ACK:

>From 1b2d2635eeabce4a2176427dc1de9c1b9b87bc7d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <address@hidden>
Date: Tue, 1 Sep 2009 13:02:13 +0200
Subject: [PATCH] chcon, chmod, chgrp, chown, du: report fts_close failure

* src/du.c (du_files): Don't fail silently upon fts_close failure.
* src/chcon.c (process_files): Likewise.
* src/chmod.c (process_files): Likewise.
* src/chown-core.c (chown_files): Likewise.
---
 src/chcon.c      |    5 ++++-
 src/chmod.c      |    5 ++++-
 src/chown-core.c |    5 ++++-
 src/du.c         |    5 ++++-
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/chcon.c b/src/chcon.c
index 83d0583..7e8250d 100644
--- a/src/chcon.c
+++ b/src/chcon.c
@@ -325,7 +325,10 @@ process_files (char **files, int bit_flags)
     }

   if (fts_close (fts) != 0)
-    ok = false;
+    {
+      error (0, errno, _("fts_close failed"));
+      ok = false;
+    }

   return ok;
 }
diff --git a/src/chmod.c b/src/chmod.c
index 0688979..282eada 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -336,7 +336,10 @@ process_files (char **files, int bit_flags)
     }

   if (fts_close (fts) != 0)
-    ok = false;
+    {
+      error (0, errno, _("fts_close failed"));
+      ok = false;
+    }

   return ok;
 }
diff --git a/src/chown-core.c b/src/chown-core.c
index 82e9644..705a29b 100644
--- a/src/chown-core.c
+++ b/src/chown-core.c
@@ -510,7 +510,10 @@ chown_files (char **files, int bit_flags,
     }

   if (fts_close (fts) != 0)
-    ok = false;
+    {
+      error (0, errno, _("fts_close failed"));
+      ok = false;
+    }

   return ok;
 }
diff --git a/src/du.c b/src/du.c
index 16a7b9b..9da901a 100644
--- a/src/du.c
+++ b/src/du.c
@@ -643,7 +643,10 @@ du_files (char **files, int bit_flags)
         }

       if (fts_close (fts) != 0)
-        ok = false;
+        {
+          error (0, errno, _("fts_close failed"));
+          ok = false;
+        }
     }

   return ok;
--
1.6.4.2.384.g5fc62




reply via email to

[Prev in Thread] Current Thread [Next in Thread]