mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-16 16:54:38 +08:00
Remove the create_dirs() function
This commit is contained in:
parent
7ba9b7fda1
commit
81b4c05b47
@ -41,40 +41,6 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
static int create_dirs(char *filename, mode_t mode)
|
||||
{
|
||||
struct stat st;
|
||||
char dir[PATH_MAX + 1], *prev, *next;
|
||||
int err;
|
||||
|
||||
err = stat(filename, &st);
|
||||
if (!err && S_ISREG(st.st_mode))
|
||||
return 0;
|
||||
|
||||
memset(dir, 0, PATH_MAX + 1);
|
||||
strcat(dir, "/");
|
||||
|
||||
prev = strchr(filename, '/');
|
||||
|
||||
while (prev) {
|
||||
next = strchr(prev + 1, '/');
|
||||
if (!next)
|
||||
break;
|
||||
|
||||
if (next - prev == 1) {
|
||||
prev = next;
|
||||
continue;
|
||||
}
|
||||
|
||||
strncat(dir, prev + 1, next - prev);
|
||||
mkdir(dir, mode);
|
||||
|
||||
prev = next;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int write_key_value(int fd, char *key, char *value)
|
||||
{
|
||||
char *str;
|
||||
|
Loading…
Reference in New Issue
Block a user