mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2025-12-20 05:40:08 +01:00
ply-utils: Create parent directory before binding concrete socket
bind()'ing a concrete socket requires that the parent directory exists already.
This commit is contained in:
parent
287ae4de45
commit
a0c2e66529
1 changed files with 7 additions and 0 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <libgen.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <math.h>
|
||||
|
|
@ -223,6 +224,12 @@ ply_listen_to_unix_socket (const char *path,
|
|||
|
||||
address = create_unix_address_from_path (path, type, &address_size);
|
||||
|
||||
if (type == PLY_UNIX_SOCKET_TYPE_CONCRETE) {
|
||||
char *writable_path = strdup (path);
|
||||
ply_create_directory (dirname (writable_path));
|
||||
free (writable_path);
|
||||
}
|
||||
|
||||
if (bind (fd, address, address_size) < 0) {
|
||||
ply_save_errno ();
|
||||
free (address);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue