xbps-create: fix formatting, set return value on path overflow
This commit is contained in:
parent
3ef932de2f
commit
c992049eb5
@ -493,7 +493,8 @@ out:
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
walk_dir(const char *path,
|
walk_dir(const char *path,
|
||||||
int (*fn) (const char *, const struct stat *sb, const struct dirent *dir)) {
|
int (*fn) (const char *, const struct stat *sb, const struct dirent *dir))
|
||||||
|
{
|
||||||
int rv, i;
|
int rv, i;
|
||||||
struct dirent **list;
|
struct dirent **list;
|
||||||
char tmp_path[PATH_MAX] = { 0 };
|
char tmp_path[PATH_MAX] = { 0 };
|
||||||
@ -505,6 +506,7 @@ walk_dir(const char *path,
|
|||||||
continue;
|
continue;
|
||||||
if (strlen(path) + strlen(list[i]->d_name) + 1 >= PATH_MAX - 1) {
|
if (strlen(path) + strlen(list[i]->d_name) + 1 >= PATH_MAX - 1) {
|
||||||
errno = ENAMETOOLONG;
|
errno = ENAMETOOLONG;
|
||||||
|
rv = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
strncpy(tmp_path, path, PATH_MAX - 1);
|
strncpy(tmp_path, path, PATH_MAX - 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user