Skip to content

Commit e8dc500

Browse files
committed
Processing (Linux): return errors more actively
fix assertion errors
1 parent bb11cff commit e8dc500

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/processing_linux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ const char* ffProcessGetBasicInfoLinux(pid_t pid, FFstrbuf* name, pid_t* ppid, i
245245
snprintf(procFilePath, sizeof(procFilePath), "/proc/%d/stat", (int)pid);
246246
char buf[PROC_FILE_BUFFSIZ];
247247
ssize_t nRead = ffReadFileData(procFilePath, sizeof(buf) - 1, buf);
248-
if(nRead < 0)
248+
if(nRead <= 8)
249249
return "ffReadFileData(/proc/pid/stat, PROC_FILE_BUFFSIZ-1, buf) failed";
250250
buf[nRead] = '\0';
251251

@@ -268,7 +268,7 @@ const char* ffProcessGetBasicInfoLinux(pid_t pid, FFstrbuf* name, pid_t* ppid, i
268268
{
269269
snprintf(procFilePath, sizeof(procFilePath), "/proc/%d/comm", (int)pid);
270270
ssize_t nRead = ffReadFileBuffer(procFilePath, name);
271-
if(nRead < 0)
271+
if(nRead <= 0)
272272
return "ffReadFileBuffer(/proc/pid/comm, name) failed";
273273
ffStrbufTrimRightSpace(name);
274274
}

0 commit comments

Comments
 (0)