Commit 89cd7793 by Qiang Huang Committed by Serge Hallyn

utils: move remove_trailing_slashes to utils

parent e555005b
......@@ -69,13 +69,6 @@ static bool file_exists(char *f)
return stat(f, &statbuf) == 0;
}
static void remove_trailing_slashes(char *p)
{
int l = strlen(p);
while (--l >= 0 && (p[l] == '/' || p[l] == '\n'))
p[l] = '\0';
}
/*
* A few functions to help detect when a container creation failed.
* If a container creation was killed partway through, then trying
......
......@@ -211,6 +211,13 @@ extern int mkdir_p(const char *dir, mode_t mode)
return 0;
}
extern void remove_trailing_slashes(char *p)
{
int l = strlen(p);
while (--l >= 0 && (p[l] == '/' || p[l] == '\n'))
p[l] = '\0';
}
static char *copy_global_config_value(char *p)
{
int len = strlen(p);
......
......@@ -37,6 +37,7 @@ extern int lxc_rmdir_onedev(char *path);
extern int lxc_setup_fs(void);
extern int get_u16(unsigned short *val, const char *arg, int base);
extern int mkdir_p(const char *dir, mode_t mode);
extern void remove_trailing_slashes(char *p);
extern const char *get_rundir(void);
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment