Commit 1ba0ed70 authored by Jan Včelák's avatar Jan Včelák 🚀

pid file: replace fgets loop with fread

parent e32f82ab
......@@ -57,14 +57,8 @@ static pid_t pid_read(const char *filename)
}
/* Read the content of the file. */
int c;
while (len < (sizeof(buf) - 1) && (c = fgetc(fp)) != EOF) {
buf[len++] = (char)c;
}
len = fread(buf, 1, sizeof(buf) - 1, fp);
fclose(fp);
/* Check for empty file. */
if (len < 1) {
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment