Skip to content

Commit

Permalink
Changed strerror to %m in format specifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
pgaskin committed Jul 28, 2020
1 parent 80409bf commit 52a4333
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/action_cc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,10 @@ NM_ACTION_(nickel_misc) {
} else if (!strcmp(arg, "force_usb_connection")) {
// we could call libnickel directly, but I prefer not to
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";
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);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ nm_config_file_t *nm_config_files() {

struct dirent **nl;
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++) {
struct dirent *de = nl[i];
Expand Down Expand Up @@ -240,7 +240,7 @@ nm_config_t *nm_config_parse(nm_config_file_t *files) {
cfgfile = fopen(cf->path, "r");

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) {
line_n++;
Expand Down
2 changes: 1 addition & 1 deletion src/generator_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ NM_GENERATOR_(_test_time) {
NM_GENERATOR_(kfmon) {
struct stat 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) {
nm_err_set(NULL);
Expand Down

0 comments on commit 52a4333

Please sign in to comment.