Use negative_errno() to assert errno is positive after a few system calls
This is not particularly intrusive because it happens in simple utility functions. It helps gcc understand that error codes are negative. This gets a rid of most of the remaining warnings.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "fd-util.h"
|
||||
#include "macro.h"
|
||||
#include "string-util.h"
|
||||
#include "util.h"
|
||||
|
||||
int clock_get_hwclock(struct tm *tm) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
@@ -121,7 +122,8 @@ int clock_set_timezone(int *min) {
|
||||
* have read from the RTC.
|
||||
*/
|
||||
if (settimeofday(tv_null, &tz) < 0)
|
||||
return -errno;
|
||||
return negative_errno();
|
||||
|
||||
if (min)
|
||||
*min = minutesdelta;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user