#include #include #include #include "cpp.h" #include "str.h" #include "proc.h" #include "xmalloc.h" static size_t argv_len(char *const argv[]) { size_t len = 0; for (; argv && *argv; argv++) len++; return len; } int cpp_exec(char *in_file, char *out_file, size_t out_len, char *const argv[]) { size_t argc = 7 + argv_len(argv); char *tmp = xstrdup(in_file); char **cpp_argv; int fd, ret = -1; char *base; unsigned int i = 0; base = basename(tmp); slprintf(out_file, out_len, "/tmp/.tmp-XXXXXX-%s", base); fd = mkstemps(out_file, strlen(base) + 1); if (fd < 0) goto err; cpp_argv = xmalloc(argc * sizeof(char *)); cpp_argv[i++] = "cpp"; for (; argv && *argv; argv++, i++) cpp_argv[i] = *argv; cpp_argv[i++] = "-I"; cpp_argv[i++] = ETCDIRE_STRING; cpp_argv[i++] = "-o"; cpp_argv[i++] = out_file; cpp_argv[i++] = in_file; cpp_argv[i++] = NULL; ret = proc_exec("cpp", cpp_argv); close(fd); xfree(cpp_argv); err: xfree(tmp); return ret; } 574e11f9059c09cc0db212546cb'/> net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-09-27 16:43:11 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2016-09-27 16:43:11 -0700
commit8ab293e3a1376574e11f9059c09cc0db212546cb (patch)
treeab3868ca55ae136df4deb8d70f78faf14b961f90
parent08895a8b6b06ed2323cd97a36ee40a116b3db8ed (diff)
parent9157056da8f8c4a6305f15619e269f164b63a6de (diff)
Merge branch 'for-4.8-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup fixes from Tejun Heo: "Three late fixes for cgroup: Two cpuset ones, one trivial and the other pretty obscure, and a cgroup core fix for a bug which impacts cgroup v2 namespace users" * 'for-4.8-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: cgroup: fix invalid controller enable rejections with cgroup namespace cpuset: fix non static symbol warning cpuset: handle race between CPU hotplug and cpuset_hotplug_work