]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(rm): Put two local variables in static storage,
authorJim Meyering <jim@meyering.net>
Sun, 16 Mar 2003 10:16:14 +0000 (10:16 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 16 Mar 2003 10:16:14 +0000 (10:16 +0000)
so they can't be clobbered by the potential longjmp.

src/remove.c

index d9a87e1c2358e073e2f37b61e3b657310a64d156..a0ad0a124b33d9f9d05998b056affd09f4ac5ec3 100644 (file)
@@ -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++)