comparison src/filedata.c @ 952:77a1d5a0326d

Optimize redundant tests.
author zas_
date Mon, 28 Jul 2008 17:56:56 +0000
parents 6ce7133c730d
children 1e61dac76311
comparison
equal deleted inserted replaced
951:6ce7133c730d 952:77a1d5a0326d
1622 else if (!access_file(dest_dir, W_OK)) 1622 else if (!access_file(dest_dir, W_OK))
1623 { 1623 {
1624 ret |= CHANGE_NO_WRITE_PERM_DEST_DIR; 1624 ret |= CHANGE_NO_WRITE_PERM_DEST_DIR;
1625 DEBUG_1("Change checked: destination dir is readonly: %s -> %s", fd->path, fd->change->dest); 1625 DEBUG_1("Change checked: destination dir is readonly: %s -> %s", fd->path, fd->change->dest);
1626 } 1626 }
1627 else if (isfile(fd->change->dest) && !access_file(fd->change->dest, W_OK) && (strcmp(fd->change->dest, fd->path) != 0))
1628 {
1629 ret |= CHANGE_NO_WRITE_PERM_DEST;
1630 DEBUG_1("Change checked: destination file exists and is readonly: %s -> %s", fd->path, fd->change->dest);
1631 }
1632 else if (isfile(fd->change->dest) && (strcmp(fd->change->dest, fd->path) != 0)) 1627 else if (isfile(fd->change->dest) && (strcmp(fd->change->dest, fd->path) != 0))
1633 { 1628 {
1634 ret |= CHANGE_WARN_DEST_EXISTS; 1629 if (!access_file(fd->change->dest, W_OK))
1635 DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest); 1630 {
1631 ret |= CHANGE_NO_WRITE_PERM_DEST;
1632 DEBUG_1("Change checked: destination file exists and is readonly: %s -> %s", fd->path, fd->change->dest);
1633 }
1634 else
1635 {
1636 ret |= CHANGE_WARN_DEST_EXISTS;
1637 DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest);
1638 }
1636 } 1639 }
1637 else if (isdir(fd->change->dest) && (strcmp(fd->change->dest, fd->path) != 0)) 1640 else if (isdir(fd->change->dest) && (strcmp(fd->change->dest, fd->path) != 0))
1638 { 1641 {
1639 ret |= CHANGE_DEST_EXISTS; 1642 ret |= CHANGE_DEST_EXISTS;
1640 DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest); 1643 DEBUG_1("Change checked: destination exists: %s -> %s", fd->path, fd->change->dest);