[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] chcon, chmod, chgrp, chown, du: do not ignore fts_close failure
From: |
Jim Meyering |
Subject: |
[PATCH] chcon, chmod, chgrp, chown, du: do not ignore fts_close failure |
Date: |
Tue, 01 Sep 2009 11:53:01 +0200 |
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.
>From e1c4f32e67dd9cf704264b4ae4d2e6020cc55ef8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 1 Sep 2009 11:31:14 +0200
Subject: [PATCH] chcon, chmod, chgrp, chown, du: do not ignore fts_close failure
This is probably never visible, but who knows...
* src/chcon.c (process_files): Don't ignore fts_close failure.
* src/chmod.c (process_files): Likewise.
* src/chown-core.c (chown_files): Likewise.
* src/du.c (du_files): Likewise.
---
src/chcon.c | 6 ++----
src/chmod.c | 6 ++----
src/chown-core.c | 6 ++----
src/du.c | 6 ++----
4 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/src/chcon.c b/src/chcon.c
index 531ed7a..83d0583 100644
--- a/src/chcon.c
+++ b/src/chcon.c
@@ -324,10 +324,8 @@ process_files (char **files, int bit_flags)
ok &= process_file (fts, ent);
}
- /* Ignore failure, since the only way it can do so is in failing to
- return to the original directory, and since we're about to exit,
- that doesn't matter. */
- fts_close (fts);
+ if (fts_close (fts) != 0)
+ ok = false;
return ok;
}
diff --git a/src/chmod.c b/src/chmod.c
index aeefcc6..0688979 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -335,10 +335,8 @@ process_files (char **files, int bit_flags)
ok &= process_file (fts, ent);
}
- /* Ignore failure, since the only way it can do so is in failing to
- return to the original directory, and since we're about to exit,
- that doesn't matter. */
- fts_close (fts);
+ if (fts_close (fts) != 0)
+ ok = false;
return ok;
}
diff --git a/src/chown-core.c b/src/chown-core.c
index eb34904..82e9644 100644
--- a/src/chown-core.c
+++ b/src/chown-core.c
@@ -509,10 +509,8 @@ chown_files (char **files, int bit_flags,
required_uid, required_gid, chopt);
}
- /* Ignore failure, since the only way it can do so is in failing to
- return to the original directory, and since we're about to exit,
- that doesn't matter. */
- fts_close (fts);
+ if (fts_close (fts) != 0)
+ ok = false;
return ok;
}
diff --git a/src/du.c b/src/du.c
index 24ed5e6..16a7b9b 100644
--- a/src/du.c
+++ b/src/du.c
@@ -642,10 +642,8 @@ du_files (char **files, int bit_flags)
ok &= process_file (fts, ent);
}
- /* Ignore failure, since the only way it can do so is in failing to
- return to the original directory, and since we're about to exit,
- that doesn't matter. */
- fts_close (fts);
+ if (fts_close (fts) != 0)
+ ok = false;
}
return ok;
--
1.6.4.2.384.g5fc62
- [PATCH] chcon, chmod, chgrp, chown, du: do not ignore fts_close failure,
Jim Meyering <=
- Re: [PATCH] chcon, chmod, chgrp, chown, du: do not ignore fts_close failure, Pádraig Brady, 2009/09/01
- Re: [PATCH] chcon, chmod, chgrp, chown, du: do not ignore fts_close failure, Jim Meyering, 2009/09/01
- Re: [PATCH] chcon, chmod, chgrp, chown, du: do not ignore fts_close failure, Jim Meyering, 2009/09/01