Skip to content

Commit

Permalink
fixup! rofiles: Add --copyup option
Browse files Browse the repository at this point in the history
  • Loading branch information
cgwalters committed Jan 5, 2018
1 parent ab634a2 commit eec2ff2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/rofiles-fuse/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,18 @@ do_open (const char *path, mode_t mode, struct fuse_file_info *finfo)
if (fd == -1)
return -errno;
}

/* Handle O_TRUNC here only after verifying hardlink state */
if (finfo->flags & O_TRUNC)
else
{
if (ftruncate (fd, 0) == -1)
/* In the non-copyup case we handle O_TRUNC here, after we've verified
* the hardlink state above with verify_write_or_copyup().
*/
if (finfo->flags & O_TRUNC)
{
(void) close (fd);
return -errno;
if (ftruncate (fd, 0) == -1)
{
(void) close (fd);
return -errno;
}
}
}
}
Expand Down

0 comments on commit eec2ff2

Please sign in to comment.