Skip to content

Commit

Permalink
proc/system: fix read always returning 0
Browse files Browse the repository at this point in the history
Since all the proc_system read functions use the return value of snprintf,
none of them actually return 0 on success.
Fix the wrong success detection by considering anything >= 0 a success.

FIXES: b01eccc
  • Loading branch information
fischerling committed Jul 30, 2024
1 parent 34104a8 commit c2babcb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mentos/src/io/proc_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static ssize_t __procs_read(vfs_file_t *file, char *buf, off_t offset, size_t nb
}
// Perform read.
ssize_t it = 0;
if (ret == 0) {
if (ret >= 0) {
size_t name_len = strlen(buffer);
size_t read_pos = offset;
if (read_pos < name_len) {
Expand Down

0 comments on commit c2babcb

Please sign in to comment.