this repo has no description
1
fork

Configure Feed

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

Error handling fixes in sysctl_proc.c

+5 -14
+5 -14
src/kernel/emulation/linux/misc/sysctl_proc.c
··· 1 1 #include <sys/sysctl.h> 2 2 #include <sys/errno.h> 3 + #include <stdbool.h> 3 4 #include "../dirent/getdirentries.h" 4 5 #include "../unistd/close.h" 5 6 #include "../unistd/read.h" ··· 116 117 return ret; 117 118 } 118 119 119 - static int read_string(const char* path, char* dst, int maxlen) 120 + static bool read_string(const char* path, char* dst, int maxlen) 120 121 { 121 122 int fd, rd; 122 123 123 124 fd = sys_open(path, BSD_O_RDONLY, 0); 124 125 if (fd < 0) 125 - return fd; 126 + return false; 126 127 127 128 rd = sys_read(fd, dst, maxlen-1); 128 129 if (rd >= 0) ··· 130 131 131 132 sys_close(fd); 132 133 return rd >= 0; 133 - } 134 - 135 - static int read_int(const char* path, int* dst) 136 - { 137 - char buf[24]; 138 - 139 - if (read_string(path, buf, sizeof(buf)) < 0) 140 - return 0; 141 - 142 - *dst = __simple_atoi(buf, NULL); 143 - return 1; 144 134 } 145 135 146 136 static const char* next_stat_elem(char** buf) ··· 386 376 buf[sizeof(argc)+arg0len+2] = 0; 387 377 memcpy(buf+sizeof(argc)+arg0len+2, cmdline, argslen+1); 388 378 } 389 - return 0; 379 + 380 + return ret; 390 381 } 391 382