Skip to content

Commit ac099c8

Browse files
committed
Report error when failing to set fan speed
References #155.
1 parent 8c89a67 commit ac099c8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/mbpfan.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,10 @@ void set_fan_speed(t_fans* fans, int speed)
376376
if(tmp->file != NULL) {
377377
char buf[16];
378378
int len = snprintf(buf, sizeof(buf), "%d", speed);
379-
pwrite(fileno(tmp->file), buf, len, /*offset=*/ 0);
379+
int res = pwrite(fileno(tmp->file), buf, len, /*offset=*/ 0);
380+
if (res == -1) {
381+
perror("Could not set fan speed");
382+
}
380383
}
381384

382385
tmp = tmp->next;

0 commit comments

Comments
 (0)