Thread (13 messages) flat view 13 messages, 4 authors, 2016-06-15

Re: [PATCH] Do _not_ call unlink on a directory

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:43:21

Thomas Glanzmann [off-list ref] writes:

I believe you still have a race condition if ...
-				if (len > state->base_dir_len && state->force && !unlink(buf) && !mkdir(buf, 0777))
-					continue;
... buf exists here as a file ...
 				if (!stat(buf, &st) && S_ISDIR(st.st_mode))
 					continue; /* ok */
... and became a directory here.
+				if (len > state->base_dir_len && state->force && !unlink(buf) && !mkdir(buf, 0777))
+					continue;
But that's quite unlikely to happen. And I have no fix to propose.

-- 
Matthieu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help