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
|
||||
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;
|
||||
struct dirent **list;
|
||||
char tmp_path[PATH_MAX] = { 0 };
|
||||
@ -505,6 +506,7 @@ walk_dir(const char *path,
|
||||
continue;
|
||||
if (strlen(path) + strlen(list[i]->d_name) + 1 >= PATH_MAX - 1) {
|
||||
errno = ENAMETOOLONG;
|
||||
rv = -1;
|
||||
break;
|
||||
}
|
||||
strncpy(tmp_path, path, PATH_MAX - 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user