Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ext2: Expand directory when adding symlinks (RHBZ#1770304).
This produced very weird bugs with missing symlinks under
certain conditions, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1781803

Fixes commit 487e8c9.
  • Loading branch information
rwmjones committed Dec 10, 2019
1 parent 487e8c9 commit 62d5c77
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/ext2fs-c.c
Expand Up @@ -791,7 +791,18 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest)
if (r > statbuf.st_size)
r = statbuf.st_size;
buf[r] = '\0';
ext2fs_symlink (data->fs, dir_ino, 0, basename, buf);
symlink_again:
err = ext2fs_symlink (data->fs, dir_ino, 0, basename, buf);
if (err) {
if (err == EXT2_ET_DIR_NO_SPACE) {
err = ext2fs_expand_dir (data->fs, dir_ino);
if (err)
ext2_error_to_exception ("ext2fs_expand_dir", err, dirname);
goto symlink_again;
}
else
ext2_error_to_exception ("ext2fs_symlink", err, basename);
}
free (buf);
}
/* Create directory. */
Expand Down

0 comments on commit 62d5c77

Please sign in to comment.