Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Properly handle case when there are no info files: index should be re…
…moved
  • Loading branch information
AMDmi3 committed Oct 26, 2016
1 parent 019f9c8 commit 1139681
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion indexinfo.c
Expand Up @@ -181,8 +181,11 @@ generate_index(fd)
int i;
int ffd;

if (sectionlen == 0)
if (sectionlen == 0) {
if (unlinkat(fd, "dir", 0) == -1)
err(EXIT_FAILURE, "Impossible to remove empty index file");
return;
}

if ((ffd = openat(fd, "dir", O_WRONLY|O_CREAT|O_TRUNC, 0644)) == -1)
err(EXIT_FAILURE, "Impossible to write the index file");
Expand Down

0 comments on commit 1139681

Please sign in to comment.