summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-03-16 10:16:14 +0000
committerJim Meyering <jim@meyering.net>2003-03-16 10:16:14 +0000
commit5151ce79b2c1533d83a9eca107f4a43d74e5c2be (patch)
tree055474f311202d06c51fa1ea8faceb7686a39d09 /src
parenta32544a77f3f9d85270944204de4983e6feec31d (diff)
downloadcoreutils-5151ce79b2c1533d83a9eca107f4a43d74e5c2be.tar.xz
(rm): Put two local variables in static storage,
so they can't be clobbered by the potential longjmp.
Diffstat (limited to 'src')
-rw-r--r--src/remove.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/remove.c b/src/remove.c
index d9a87e1c2..a0ad0a124 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -1111,10 +1111,13 @@ enum RM_status
rm (size_t n_files, char const *const *file, struct rm_options const *x)
{
struct saved_cwd *cwd_state = NULL;
- enum RM_status status = RM_OK;
- size_t i;
Dirstack_state *ds;
+ /* Put the following two variables in static storage, so they can't
+ be clobbered by the potential longjmp into this function. */
+ static enum RM_status status = RM_OK;
+ static size_t i;
+
ds = ds_init ();
for (i = 0; i < n_files; i++)