mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
main: Move storage directory creation into storage functionality
This commit is contained in:
parent
7e5ddb15d7
commit
45d5c67cb4
@ -451,15 +451,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
exit_status = EXIT_FAILURE;
|
||||
|
||||
if (create_dirs(DAEMON_STORAGEDIR "/")) {
|
||||
l_error("Failed to create " DAEMON_STORAGEDIR "/");
|
||||
if (!storage_create_dirs())
|
||||
goto fail_dbus;
|
||||
}
|
||||
|
||||
if (create_dirs(DAEMON_STORAGEDIR "/hotspot/")) {
|
||||
l_error("Failed to create " DAEMON_STORAGEDIR "/hotspot/");
|
||||
goto fail_dbus;
|
||||
}
|
||||
|
||||
genl = l_genl_new();
|
||||
if (!genl) {
|
||||
|
@ -46,7 +46,7 @@
|
||||
#define STORAGE_DIR_MODE (S_IRUSR | S_IWUSR | S_IXUSR)
|
||||
#define STORAGE_FILE_MODE (S_IRUSR | S_IWUSR)
|
||||
|
||||
int create_dirs(const char *filename)
|
||||
static int create_dirs(const char *filename)
|
||||
{
|
||||
struct stat st;
|
||||
char *dir;
|
||||
@ -165,6 +165,21 @@ error_create_dirs:
|
||||
return r;
|
||||
}
|
||||
|
||||
bool storage_create_dirs(void)
|
||||
{
|
||||
if (create_dirs(DAEMON_STORAGEDIR "/")) {
|
||||
l_error("Failed to create " DAEMON_STORAGEDIR "/");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (create_dirs(DAEMON_STORAGEDIR "/hotspot/")) {
|
||||
l_error("Failed to create " DAEMON_STORAGEDIR "/hotspot/");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
char *storage_get_network_file_path(enum security type, const char *ssid)
|
||||
{
|
||||
char *path;
|
||||
|
@ -25,14 +25,14 @@
|
||||
struct l_settings;
|
||||
enum security;
|
||||
|
||||
int create_dirs(const char *filename);
|
||||
|
||||
ssize_t read_file(void *buffer, size_t len, const char *path_fmt, ...)
|
||||
__attribute__((format(printf, 3, 4)));
|
||||
|
||||
ssize_t write_file(const void *buffer, size_t len, const char *path_fmt, ...)
|
||||
__attribute__((format(printf, 3, 4)));
|
||||
|
||||
bool storage_create_dirs(void);
|
||||
|
||||
const char *storage_network_ssid_from_path(const char *path,
|
||||
enum security *type);
|
||||
char *storage_get_network_file_path(enum security type, const char *ssid);
|
||||
|
Loading…
Reference in New Issue
Block a user