this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove unused code from startup/darling.c

+2 -52
+2 -52
src/startup/darling.c
··· 25 25 #include <alloca.h> 26 26 #include <errno.h> 27 27 #include <fcntl.h> 28 - #include <dirent.h> 29 28 #include <sys/stat.h> 30 29 #include <signal.h> 31 30 #include <stdbool.h> 32 31 #include <sched.h> 33 - #include <sys/mount.h> 34 - #include <sys/wait.h> 35 - #include <sys/prctl.h> 36 - #include <sys/utsname.h> 37 - #include <sys/stat.h> 38 - #include <sys/syscall.h> 39 - #include <sys/inotify.h> 40 32 #include <sys/poll.h> 41 33 #include <sys/socket.h> 42 34 #include <sys/un.h> 43 35 #include <getopt.h> 44 36 #include <termios.h> 45 - #include <ctype.h> 46 37 #include <pty.h> 47 38 #include <pwd.h> 48 39 #include "../shellspawn/shellspawn.h" ··· 55 46 // (dunno which one is really responsible for this). 56 47 #define USE_LINUX_4_11_HACK 1 57 48 58 - const char* DARLING_INIT_COMM = "darling-init"; 59 49 char *prefix; 60 50 uid_t g_originalUid, g_originalGid; 61 51 bool g_fixPermissions = false; 62 - char **g_argv, **g_envp; 63 52 char g_workingDirectory[4096]; 64 53 65 - int main(int argc, char ** argv, char ** envp) 54 + int main(int argc, char ** argv) 66 55 { 67 56 pid_t pidInit; 68 - int wstatus; 69 57 70 58 if (argc <= 1) 71 59 { ··· 73 61 return 1; 74 62 } 75 63 76 - g_argv = argv; 77 - g_envp = envp; 78 - 79 64 if (geteuid() != 0) 80 65 { 81 66 missingSetuidRoot(); ··· 161 146 // this is where we ask it to shut down nicely 162 147 163 148 char path_buf[128]; 164 - char read_buf[128]; 165 149 FILE* file; 166 150 pid_t launchd_pid; 167 151 snprintf(path_buf, sizeof(path_buf), "/proc/%d/task/%d/children", pidInit, pidInit); ··· 180 164 return 0; 181 165 } 182 166 183 - start_init: 184 167 // If prefix's init is not running, start it up 185 168 if (pidInit == 0) 186 169 { ··· 220 203 else 221 204 { 222 205 char *fullPath; 223 - char** child_argv; 224 206 char *path = realpath(argv[1], NULL); 225 207 226 208 if (path == NULL) ··· 318 300 msg.msg_iovlen = 1; 319 301 320 302 cmptr = CMSG_FIRSTHDR(&msg); 321 - 322 303 cmptr->cmsg_len = CMSG_LEN(sizeof(int) * 3); 323 304 cmptr->cmsg_level = SOL_SOCKET; 324 305 cmptr->cmsg_type = SCM_RIGHTS; ··· 555 536 { 556 537 size_t total_len = 0; 557 538 int count; 558 - char buffer1[4096]; 559 539 char buffer2[4096]; 560 540 int sockfd; 561 541 struct sockaddr_un addr; ··· 657 637 fds[1] = STDOUT_FILENO; 658 638 if (master == -1 || !isatty(STDERR_FILENO)) 659 639 fds[2] = STDERR_FILENO; 660 - 640 + 661 641 pushShellspawnCommandFDs(sockfd, SHELLSPAWN_GO, fds); 662 642 close(fds[0]); 663 643 ··· 701 681 fprintf(stderr, "Darling needs this in order to create mount and PID namespaces and to perform mounts.\n"); 702 682 } 703 683 704 - static uint32_t linux_release(void) 705 - { 706 - struct utsname uts; 707 - if (uname(&uts) == 0) 708 - { 709 - char* p = uts.release; 710 - uint32_t version = 0; 711 - int digits = 0; 712 - 713 - while (*p && digits < 3) 714 - { 715 - if (isdigit(*p)) 716 - { 717 - version <<= 8; 718 - version |= strtol(p, &p, 10); 719 - digits++; 720 - } 721 - else 722 - p++; 723 - } 724 - 725 - return version; 726 - } 727 - return 0; 728 - } 729 - 730 - #define LINUX_RELEASE(a,b,c) ((a << 16) | (b << 8) | (c)) 731 - 732 684 pid_t spawnInitProcess(void) 733 685 { 734 686 pid_t pid; 735 687 int pipefd[2]; 736 - char path[1024]; 737 688 char buffer[1]; 738 - FILE *file; 739 689 740 690 if (pipe(pipefd) == -1) 741 691 {