Explorar o código

strtok() has no effect on buf && fgets() should have the full buffer length

raiz %!s(int64=9) %!d(string=hai) anos
pai
achega
3bfc3bbcae
Modificáronse 1 ficheiros con 1 adicións e 2 borrados
  1. 1 2
      slstatus.c

+ 1 - 2
slstatus.c

@@ -413,11 +413,10 @@ run_command(const char *cmd)
 		warn("Failed to get command output for %s", cmd);
 		return smprintf(UNKNOWN_STR);
 	}
-	fgets(buf, sizeof(buf)-1, fp);
+	fgets(buf, sizeof(buf), fp);
 	pclose(fp);
 
 	buf[strlen(buf)] = '\0';
-	strtok(buf, "\n");
 
 	return smprintf("%s", buf);
 }