Skip to content

Commit

Permalink
Move dest_dir variable to inner block.
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Monin committed Jul 28, 2008
1 parent 9899b80 commit 299bab0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/filedata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,6 @@ gint file_data_verify_ci(FileData *fd)
{
gint ret = CHANGE_OK;
gchar *dir;
gchar *dest_dir = NULL;

if (!fd->change)
{
Expand All @@ -1574,8 +1573,6 @@ gint file_data_verify_ci(FileData *fd)

dir = remove_level_from_path(fd->path);

if (fd->change->dest) dest_dir = remove_level_from_path(fd->change->dest);

if (fd->change->type != FILEDATA_CHANGE_DELETE &&
!access_file(fd->path, R_OK))
{
Expand All @@ -1598,6 +1595,7 @@ gint file_data_verify_ci(FileData *fd)

if (fd->change->dest)
{
gchar *dest_dir;
const gchar *dest_ext = extension_from_path(fd->change->dest);
if (!dest_ext) dest_ext = "";

Expand All @@ -1614,6 +1612,8 @@ gint file_data_verify_ci(FileData *fd)
DEBUG_1("Change checked: source and destination are the same: %s -> %s", fd->path, fd->change->dest);
}

dest_dir = remove_level_from_path(fd->change->dest);

if (!isdir(dest_dir))
{
ret |= CHANGE_NO_DEST_DIR;
Expand All @@ -1639,13 +1639,14 @@ gint file_data_verify_ci(FileData *fd)
ret |= CHANGE_DEST_EXISTS;
DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest);
}

g_free(dest_dir);
}

fd->change->error = ret;
if (ret == 0) DEBUG_1("Change checked: OK: %s", fd->path);

g_free(dir);
g_free(dest_dir);
return ret;
}

Expand Down

0 comments on commit 299bab0

Please sign in to comment.