summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo/files/0003-Fix-renameat-parallel-to-previous-fix-to-rename.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/pseudo/files/0003-Fix-renameat-parallel-to-previous-fix-to-rename.patch')
-rw-r--r--meta/recipes-devtools/pseudo/files/0003-Fix-renameat-parallel-to-previous-fix-to-rename.patch64
1 files changed, 0 insertions, 64 deletions
diff --git a/meta/recipes-devtools/pseudo/files/0003-Fix-renameat-parallel-to-previous-fix-to-rename.patch b/meta/recipes-devtools/pseudo/files/0003-Fix-renameat-parallel-to-previous-fix-to-rename.patch
deleted file mode 100644
index 739c03ee6e..0000000000
--- a/meta/recipes-devtools/pseudo/files/0003-Fix-renameat-parallel-to-previous-fix-to-rename.patch
+++ /dev/null
@@ -1,64 +0,0 @@
1From d9ab3a0acc94151048498b1ea4d69e7707df1526 Mon Sep 17 00:00:00 2001
2From: Seebs <seebs@seebs.net>
3Date: Fri, 30 Sep 2016 10:56:35 -0500
4Subject: [PATCH 3/3] Fix renameat (parallel to previous fix to rename)
5
6There was a bug in rename(), which was duplicated when renameat() was
7implemented, and which got fixed two years ago for rename(), but no
8one ever uses renameat() so it didn't get fixed there. Thanks
9to Anton Gerasimov <anton@advancedtelematic.com> for the bug report
10and patch.
11
12Signed-off-by: Seebs <seebs@seebs.net>
13
14Upstream-Status: Backport
15Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
16
17---
18 ChangeLog.txt | 4 ++++
19 ports/unix/guts/renameat.c | 7 ++++++-
20 2 files changed, 10 insertions(+), 1 deletion(-)
21
22diff --git a/ChangeLog.txt b/ChangeLog.txt
23index 65b9759..ca04cc0 100644
24--- a/ChangeLog.txt
25+++ b/ChangeLog.txt
26@@ -1,3 +1,7 @@
27+2016-09-30:
28+ * (seebs) Fix rename at, matching fix from ee00f63d for rename. Bug
29+ and fix provided by Anton Gerasimov <anton@advancedtelematic.com>.
30+
31 2016-09-28:
32 * (seebs) Send errors to log when daemonizing, but do that a lot
33 sooner to prevent startup messages which can show up spuriously
34diff --git a/ports/unix/guts/renameat.c b/ports/unix/guts/renameat.c
35index ade0509..d5e36fa 100644
36--- a/ports/unix/guts/renameat.c
37+++ b/ports/unix/guts/renameat.c
38@@ -11,6 +11,7 @@
39 int oldrc, newrc;
40 int save_errno;
41 int old_db_entry = 0;
42+ int may_unlinked = 0;
43
44 pseudo_debug(PDBGF_FILE, "renameat: %d,%s->%d,%s\n",
45 olddirfd, oldpath ? oldpath : "<nil>",
46@@ -44,10 +45,14 @@
47 /* as with unlink, we have to mark that the file may get deleted */
48 msg = pseudo_client_op(OP_MAY_UNLINK, 0, -1, newdirfd, newpath, newrc ? NULL : &newbuf);
49 if (msg && msg->result == RESULT_SUCCEED)
50+ may_unlinked = 1;
51+ msg = pseudo_client_op(OP_STAT, 0, -1, olddirfd, oldpath, oldrc ? NULL : &oldbuf);
52+ if (msg && msg->result == RESULT_SUCCEED)
53 old_db_entry = 1;
54+
55 rc = real_renameat(olddirfd, oldpath, newdirfd, newpath);
56 save_errno = errno;
57- if (old_db_entry) {
58+ if (may_unlinked) {
59 if (rc == -1) {
60 /* since we failed, that wasn't really unlinked -- put
61 * it back.
62--
632.7.4
64