Skip to content
Snippets Groups Projects
Commit 1ba0ed70 authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

pid file: replace fgets loop with fread

parent e32f82ab
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment