aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.txt6
-rw-r--r--pseudo.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 169e707..e0783fb 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,9 @@
+2018-03-01:
+ * (seebs) If you get a CREAT for an existing file, and it matches
+ both path and inode, don't delete the entry because the inode
+ matched and then not create it because the path used to match
+ before you delete it.
+
2018-02-26:
* (seebs) implement mkstemps, mkostemp, and mkostemps. Actually,
move implementation all to mkostemps, then implement the others
diff --git a/pseudo.c b/pseudo.c
index a3bc7fa..90de051 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -444,7 +444,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
char *path_by_ino = 0;
char *oldpath = 0;
size_t oldpathlen = 0;
- int found_path = 0, found_ino = 0;
+ int found_path = 0, found_ino = 0, found_exact = 0;
int prefer_ino = 0;
int xattr_flags = 0;
int trailing_slash = 0;
@@ -543,6 +543,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
*msg = msg_header;
found_path = 1;
found_ino = 1;
+ found_exact = 1;
/* note: we have to avoid freeing this later */
path_by_ino = msg->path;
if (msg->op == OP_LINK) {
@@ -768,9 +769,11 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
break;
case OP_CREAT:
/* implies a new file -- not a link, which would be OP_LINK */
- if (found_ino) {
+ if (found_ino && !found_exact) {
/* CREAT should never be sent if the file existed.
* So, any existing entry is an error. Nuke it.
+ * ... But only if it wasn't a match on both inode *and*
+ * path, because if it were, that would be harmless.
*/
pseudo_diag("creat for '%s' replaces existing %llu ['%s'].\n",
msg->pathlen ? msg->path : "no path",