]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Receive.pm
Reviewed patch.
[git.ikiwiki.info.git] / IkiWiki / Receive.pm
index 5908e09f953ad09cb576cae6c956230be497d6df..f985f560b3d17b38aeef783a3b0ccbd0960d034d 100644 (file)
@@ -26,6 +26,8 @@ sub genwrapper () {
        my $ret=<<"EOF";
        {
                int u=getuid();
        my $ret=<<"EOF";
        {
                int u=getuid();
+               /* 3 characters per byte is certainly enough */
+               char uid_string[sizeof(u) * 3 + 1];
 EOF
        $ret.="\t\tif ( ".
                join("&&", map {
 EOF
        $ret.="\t\tif ( ".
                join("&&", map {
@@ -46,8 +48,8 @@ EOF
                        while (read(0, &buf, 256) != 0) {}
                        exit(0);
                }
                        while (read(0, &buf, 256) != 0) {}
                        exit(0);
                }
-               asprintf(&s, "CALLER_UID=%i", u);
-               newenviron[i++]=s;
+               snprintf(uid_string, sizeof(uid_string), "%i", u);
+               addenv("CALLER_UID", uid_string);
        }
 EOF
        return $ret;
        }
 EOF
        return $ret;