eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit a327e3f4d8456252ab107191bbf2f62be05468fa
parent 8232fbddbf3449fcef8f1dc031b15faef9007d3c
Author: James Prestwood <prestwoj@gmail.com>
Date:   Tue,  9 Feb 2021 12:37:13 -0800

client: remove warning on mkdir return

This fixes up a previous commit which breaks iwctl. The
check was added to satisfy static analysis but it ended
up preventing iwctl from starting. In this case mkdir
can fail (e.g. if the directory already exists) and only
if it fails should the history be read. Otherwise a
successful mkdir return indicates the history folder is
new and there is no reason to try reading it.

Diffstat:
Mclient/display.c | 16+++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/client/display.c b/client/display.c @@ -681,7 +681,6 @@ void display_init(void) { const char *data_home; char *data_path; - int ret; display_refresh.redo_entries = l_queue_new(); @@ -702,16 +701,15 @@ void display_init(void) } if (data_path) { - ret = mkdir(data_path, 0700); - /* Not much can be done since display isn't even initialized */ - if (L_WARN_ON(ret < 0)) { - l_free(data_path); - return; + /* + * If mkdir succeeds that means its a new directory, no need + * to read the history since it doesn't exist + */ + if (mkdir(data_path, 0700) != 0) { + history_path = l_strdup_printf("%s/history", data_path); + read_history(history_path); } - history_path = l_strdup_printf("%s/history", data_path); - read_history(history_path); - l_free(data_path); } else { history_path = NULL;