The following commit has been merged in the master branch:
commit 46af84cb64fdd4cf6fc9a3bbbf7ed22965cc073e
Author: Guillem Jover <[email protected]>
Date:   Wed Jul 4 16:21:03 2012 +0200

    dpkg-divert: Rename file_copy() arguments

diff --git a/src/divertcmd.c b/src/divertcmd.c
index 55817eb..b5ec61b 100644
--- a/src/divertcmd.c
+++ b/src/divertcmd.c
@@ -206,39 +206,39 @@ check_rename(struct file *src, struct file *dst)
 }
 
 static void
-file_copy(const char *src, const char *realdst)
+file_copy(const char *src, const char *dst)
 {
        struct dpkg_error err;
-       char *dst;
+       char *tmp;
        int srcfd, dstfd;
 
        srcfd = open(src, O_RDONLY);
        if (srcfd < 0)
                ohshite(_("unable to open file '%s'"), src);
 
-       m_asprintf(&dst, "%s%s", realdst, ".dpkg-divert.tmp");
-       dstfd = creat(dst, 0600);
+       m_asprintf(&tmp, "%s%s", dst, ".dpkg-divert.tmp");
+       dstfd = creat(tmp, 0600);
        if (dstfd < 0)
-               ohshite(_("unable to create file '%s'"), dst);
+               ohshite(_("unable to create file '%s'"), tmp);
 
-       push_cleanup(cu_filename, ~ehflag_normaltidy, NULL, 0, 1, dst);
+       push_cleanup(cu_filename, ~ehflag_normaltidy, NULL, 0, 1, tmp);
 
        if (fd_fd_copy(srcfd, dstfd, -1, &err) < 0)
-               ohshit(_("cannot copy '%s' to '%s': %s"), src, dst, err.str);
+               ohshit(_("cannot copy '%s' to '%s': %s"), src, tmp, err.str);
 
        close(srcfd);
 
        if (fsync(dstfd))
-               ohshite(_("unable to sync file '%s'"), dst);
+               ohshite(_("unable to sync file '%s'"), tmp);
        if (close(dstfd))
-               ohshite(_("unable to close file '%s'"), dst);
+               ohshite(_("unable to close file '%s'"), tmp);
 
-       file_copy_perms(src, dst);
+       file_copy_perms(src, tmp);
 
-       if (rename(dst, realdst) != 0)
-               ohshite(_("cannot rename '%s' to '%s'"), dst, realdst);
+       if (rename(tmp, dst) != 0)
+               ohshite(_("cannot rename '%s' to '%s'"), tmp, dst);
 
-       free(dst);
+       free(tmp);
 
        pop_cleanup(ehflag_normaltidy);
 }

-- 
dpkg's main repository


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

Reply via email to