Skip to content

Commit

Permalink
Optimize redundant tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Monin committed Jul 28, 2008
1 parent 299bab0 commit 660c688
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/filedata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1624,15 +1624,18 @@ gint file_data_verify_ci(FileData *fd)
ret |= CHANGE_NO_WRITE_PERM_DEST_DIR;
DEBUG_1("Change checked: destination dir is readonly: %s -> %s", fd->path, fd->change->dest);
}
else if (isfile(fd->change->dest) && !access_file(fd->change->dest, W_OK) && (strcmp(fd->change->dest, fd->path) != 0))
{
ret |= CHANGE_NO_WRITE_PERM_DEST;
DEBUG_1("Change checked: destination file exists and is readonly: %s -> %s", fd->path, fd->change->dest);
}
else if (isfile(fd->change->dest) && (strcmp(fd->change->dest, fd->path) != 0))
{
ret |= CHANGE_WARN_DEST_EXISTS;
DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest);
if (!access_file(fd->change->dest, W_OK))
{
ret |= CHANGE_NO_WRITE_PERM_DEST;
DEBUG_1("Change checked: destination file exists and is readonly: %s -> %s", fd->path, fd->change->dest);
}
else
{
ret |= CHANGE_WARN_DEST_EXISTS;
DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest);
}
}
else if (isdir(fd->change->dest) && (strcmp(fd->change->dest, fd->path) != 0))
{
Expand Down

0 comments on commit 660c688

Please sign in to comment.