The following commit has been merged in the master branch:
commit c644793d5ccaf02242d814ce79e45a4210481aa3
Author: Guillem Jover <[email protected]>
Date:   Wed Oct 14 04:27:03 2009 +0200

    dpkg-statoverride: Fallback to printing #<id> if db lookup fails
    
    This allows it to gracefully handle uid and gid not present on the
    password databases, when storing on the overrides db, in a similar way
    as the perl implementation was behaving.
    
    Spotted-by: RaphaĆ«l Hertzog <[email protected]>

diff --git a/src/statcmd.c b/src/statcmd.c
index fe30b8e..3c25220 100644
--- a/src/statcmd.c
+++ b/src/statcmd.c
@@ -194,14 +194,18 @@ statdb_node_print(FILE *out, struct filenamenode *file)
                return;
 
        pw = getpwuid(filestat->uid);
-       if (pw == NULL)
-               ohshite(_("error getting user name for uid %d"), filestat->uid);
+       if (pw)
+               fprintf(out, "%s ", pw->pw_name);
+       else
+               fprintf(out, "#%d ", filestat->uid);
+
        gr = getgrgid(filestat->gid);
-       if (gr == NULL)
-               ohshite(_("error getting group name for gid %d"), 
filestat->gid);
+       if (gr)
+               fprintf(out, "%s ", gr->gr_name);
+       else
+               fprintf(out, "#%d ", filestat->gid);
 
-       fprintf(out, "%s %s %o %s\n", pw->pw_name, gr->gr_name, filestat->mode,
-               file->name);
+       fprintf(out, "%o %s\n", filestat->mode, file->name);
 }
 
 static void

-- 
dpkg's main repository


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

Reply via email to