The following commit has been merged in the master branch:
commit 611e3235622c2b6940df5c961faf148e4528b4b1
Author: Raphaël Hertzog <[email protected]>
Date:   Thu Jul 22 22:19:31 2010 +0200

    Check the stat structure only if it has been initialized
    
    For non-existing files the stat structure is not initialized and S_ISDIR 
would
    randomly return true leading to the "Cannot divert directories" error
    message.
    
    This fixes the test-suite on i386.

diff --git a/src/divertcmd.c b/src/divertcmd.c
index 6e559c9..1e7614f 100644
--- a/src/divertcmd.c
+++ b/src/divertcmd.c
@@ -427,7 +427,8 @@ diversion_add(const char *const *argv)
        file_init(&file_from, filename);
        file_stat(&file_from);
 
-       if (S_ISDIR(file_from.stat.st_mode))
+       if (file_from.stat_state == file_stat_valid &&
+           S_ISDIR(file_from.stat.st_mode))
                badusage(_("Cannot divert directories"));
 
        fnn_from = findnamenode(filename, 0);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to