1
0

Changed strerror to %m in format specifiers

This commit is contained in:
Patrick Gaskin
2020-07-27 21:29:30 -04:00
parent 80409bf294
commit 52a4333eb2
3 changed files with 5 additions and 5 deletions

View File

@@ -446,10 +446,10 @@ NM_ACTION_(nickel_misc) {
} else if (!strcmp(arg, "force_usb_connection")) { } else if (!strcmp(arg, "force_usb_connection")) {
// we could call libnickel directly, but I prefer not to // we could call libnickel directly, but I prefer not to
FILE *nhs; FILE *nhs;
NM_CHECK(nullptr, (nhs = fopen("/tmp/nickel-hardware-status", "w")), "could not open nickel hardware status pipe: %s", strerror(errno)); NM_CHECK(nullptr, (nhs = fopen("/tmp/nickel-hardware-status", "w")), "could not open nickel hardware status pipe: %m");
const char *msg = "usb plug add"; const char *msg = "usb plug add";
NM_CHECK(nullptr, fputs(msg, nhs) >= 0, "could not write message '%s' to pipe: %s", msg, strerror(errno)); NM_CHECK(nullptr, fputs(msg, nhs) >= 0, "could not write message '%s' to pipe: %m", msg);
fclose(nhs); fclose(nhs);
} else { } else {

View File

@@ -51,7 +51,7 @@ nm_config_file_t *nm_config_files() {
struct dirent **nl; struct dirent **nl;
int n = scandir(NM_CONFIG_DIR, &nl, nm_config_files_filter, alphasort); int n = scandir(NM_CONFIG_DIR, &nl, nm_config_files_filter, alphasort);
NM_CHECK(NULL, n != -1, "could not scan config dir: %s", strerror(errno)); NM_CHECK(NULL, n != -1, "could not scan config dir: %m");
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
struct dirent *de = nl[i]; struct dirent *de = nl[i];
@@ -240,7 +240,7 @@ nm_config_t *nm_config_parse(nm_config_file_t *files) {
cfgfile = fopen(cf->path, "r"); cfgfile = fopen(cf->path, "r");
if (!cfgfile) if (!cfgfile)
RETERR("could not open file: %s", strerror(errno)); RETERR("could not open file: %m");
while ((line_sz = getline(&line, &line_bufsz, cfgfile)) != -1) { while ((line_sz = getline(&line, &line_bufsz, cfgfile)) != -1) {
line_n++; line_n++;

View File

@@ -91,7 +91,7 @@ NM_GENERATOR_(_test_time) {
NM_GENERATOR_(kfmon) { NM_GENERATOR_(kfmon) {
struct stat sb; struct stat sb;
if (stat(KFMON_IPC_SOCKET, &sb)) if (stat(KFMON_IPC_SOCKET, &sb))
NM_ERR_RET(NULL, "error checking '%s': stat: %s", KFMON_IPC_SOCKET, strerror(errno)); NM_ERR_RET(NULL, "error checking '%s': stat: %m", KFMON_IPC_SOCKET);
if (time_in_out->tv_sec == sb.st_mtim.tv_sec && time_in_out->tv_nsec == sb.st_mtim.tv_nsec) { if (time_in_out->tv_sec == sb.st_mtim.tv_sec && time_in_out->tv_nsec == sb.st_mtim.tv_nsec) {
nm_err_set(NULL); nm_err_set(NULL);