Micro optimizations

This commit is contained in:
topjohnwu
2018-11-13 02:07:02 -05:00
parent 9592a69986
commit 3a2a2a4ffa
6 changed files with 26 additions and 26 deletions
-14
View File
@@ -67,20 +67,6 @@ ssize_t fdgets(char *buf, const size_t size, int fd) {
return len;
}
int switch_mnt_ns(int pid) {
char mnt[32];
snprintf(mnt, sizeof(mnt), "/proc/%d/ns/mnt", pid);
if(access(mnt, R_OK) == -1) return 1; // Maybe process died..
int fd, ret;
fd = xopen(mnt, O_RDONLY);
if (fd < 0) return 1;
// Switch to its namespace
ret = xsetns(fd, 0);
close(fd);
return ret;
}
int fork_dont_care() {
int pid = xfork();
if (pid) {