File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ void set_socket_create_context(const char *context) {
5858 return ;
5959 }
6060
61- if (write (context , 1 , strlen (context ), sockcreate ) != strlen (context )) {
61+ if (write (sockcreate , context , strlen (context )) != ( ssize_t ) strlen (context )) {
6262 LOGE ("fwrite: %s\n" , strerror (errno ));
6363 errno = 0 ;
6464
@@ -72,15 +72,15 @@ static void get_current_attr(char *output) {
7272 char path [PATH_MAX ];
7373 snprintf (path , PATH_MAX , "/proc/self/attr/current" );
7474
75- int current = open (path , O_RDONLY | O_CLOEXEC );
76- if (current == -1 ) {
75+ FILE * current = fopen (path , "r" );
76+ if (current == NULL ) {
7777 LOGE ("Failed to open current: %s\n" , strerror (errno ));
7878 errno = 0 ;
7979
8080 return ;
8181 }
8282
83- if (fgets (output , PATH_MAX , fileno ( current ) ) == NULL ) {
83+ if (fgets (output , PATH_MAX , current ) == NULL ) {
8484 LOGE ("fgets: %s\n" , strerror (errno ));
8585 errno = 0 ;
8686
You can’t perform that action at this time.
0 commit comments