Skip to content

Commit

Permalink
del warn(NULL)
Browse files Browse the repository at this point in the history
The message displayed by `warn(NULL)` makes no one happy.
  • Loading branch information
KusaReMKN committed Apr 6, 2022
1 parent d34939c commit 80de5d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([sendwol], [0.10], [https://github.com/KusaReMKN/sendwol/issue])
AC_INIT([sendwol], [0.11], [https://github.com/KusaReMKN/sendwol/issue])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([sendwol.c])
AC_CONFIG_HEADERS([config.h])
Expand Down
2 changes: 1 addition & 1 deletion sendwol.1
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ By default,
.Pa $HOME/.sendwol
and
.Pa /etc/ethers
are looked up in this order.
are looked up in this order if they exist.
The specified file is looked up before them.
If this option is specified more than once,
those specified later will be looked up first.
Expand Down
18 changes: 8 additions & 10 deletions sendwol.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,12 @@ main(int argc, char *argv[])
goto dberror;

homesendwol = home_sendwol();
if (homesendwol != NULL) {
if (homesendwol != NULL)
if (push_dblist(&list, homesendwol) == -1) {
dberror: warn(NULL);
warnx("database files are not available");
dberror: warnx("database files are not available");
free_dblist(list);
list = NULL;
}
} else {
warn(NULL);
warnx("~/.sendwol is not available");
}

forcev4 = 0;
forcev6 = 0;
Expand All @@ -140,7 +135,6 @@ dberror: warn(NULL);
if (list == NULL)
break;
if (push_dblist(&list, optarg) == -1) {
warn(NULL);
warnx("database files are not available");
free_dblist(list);
list = NULL;
Expand Down Expand Up @@ -308,8 +302,10 @@ home_sendwol(void)

length = snprintf(NULL, 0, HOME_SENDWOL, home) + 1;
buffer = (char *)malloc(length);
if (buffer == NULL)
if (buffer == NULL) {
warn("malloc");
return NULL;
}

snprintf(buffer, length, HOME_SENDWOL, home);

Expand Down Expand Up @@ -403,8 +399,10 @@ push_dblist(struct dblist **restrict headp, const char *restrict path)
struct dblist *temp;

temp = (struct dblist *)malloc(sizeof(*temp));
if (temp == NULL)
if (temp == NULL) {
warn("malloc");
return -1;
}

temp->dbl_next = *headp;
temp->dbl_path = path;
Expand Down

0 comments on commit 80de5d4

Please sign in to comment.