ww build: honor Go output permission modes

This commit is contained in:
2026-08-20 22:03:09 +09:00
parent 77168fd891
commit 84f5e68709
8 changed files with 513 additions and 9 deletions

27
test/package/umaskexec.c Normal file
View File

@@ -0,0 +1,27 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
int
main(int argc, char **argv)
{
char *end;
unsigned long mask;
if (argc < 3) {
fputs("usage: package-umaskexec MASK PROGRAM [ARG ...]\n", stderr);
return 2;
}
errno = 0;
mask = strtoul(argv[1], &end, 8);
if (errno != 0 || end == argv[1] || *end != '\0' || mask > 0777) {
fputs("package-umaskexec: invalid mask\n", stderr);
return 2;
}
umask((mode_t)mask);
execv(argv[2], &argv[2]);
fputs("package-umaskexec: exec failed\n", stderr);
return 127;
}