3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 10:39:23 +01:00

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.
This commit is contained in:
James Prestwood 2021-02-09 12:37:13 -08:00 committed by Denis Kenzior
parent 8232fbddbf
commit a327e3f4d8

View File

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