From: Jim Meyering Date: Sun, 16 Mar 2003 10:16:14 +0000 (+0000) Subject: (rm): Put two local variables in static storage, X-Git-Tag: v4.5.11~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5151ce79b2c1533d83a9eca107f4a43d74e5c2be;p=thirdparty%2Fcoreutils.git (rm): Put two local variables in static storage, so they can't be clobbered by the potential longjmp. --- diff --git a/src/remove.c b/src/remove.c index d9a87e1c23..a0ad0a124b 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++)