浏览代码

Fix build break

master
Arun Prakash Jana 5 年前
父节点
当前提交
06f6435ebd
找不到此签名对应的密钥 GPG 密钥 ID: A75979F35C080412
共有 1 个文件被更改,包括 16 次插入7 次删除
  1. +16
    -7
      src/nnn.c

+ 16
- 7
src/nnn.c 查看文件

@@ -6178,12 +6178,12 @@ static char *load_input()
break; break;


if (chunk_count == 512 || !(input = xrealloc(input, (chunk_count + 1) * chunk))) if (chunk_count == 512 || !(input = xrealloc(input, (chunk_count + 1) * chunk)))
goto malloc_2; goto malloc_1;
} }


if (off != total_read) { if (off != total_read) {
if (entries == (1 << 16)) if (entries == (1 << 16))
goto malloc_2; goto malloc_1;


paths[entries++] = input + off; paths[entries++] = input + off;
} }
@@ -6195,16 +6195,25 @@ static char *load_input()


g_prefixpath = malloc(sizeof(char) * PATH_MAX); g_prefixpath = malloc(sizeof(char) * PATH_MAX);
if (!g_prefixpath) if (!g_prefixpath)
goto malloc_2; goto malloc_1;


if (!(paths[0] = xrealpath(paths[0], cwd))) if (!(paths[0] = xrealpath(paths[0], cwd)))
goto malloc_2; // free all entries goto malloc_1; // free all entries


xstrlcpy(g_prefixpath, paths[0], strlen(paths[0]) + 1); xstrlcpy(g_prefixpath, paths[0], strlen(paths[0]) + 1);


for (i = 1; i < entries; ++i) for (i = 1; i < entries; ++i) {
if (!(paths[i] = xrealpath(paths[i], cwd)) || !common_prefix(paths[i], g_prefixpath)) if (!(paths[i] = xrealpath(paths[i], cwd))) {
goto malloc_2; // free all entries entries = i; // free from the previous entry
goto malloc_2;

}

if (!common_prefix(paths[i], g_prefixpath)) {
entries = i + 1; // free from the current entry
goto malloc_2;
}
}


if (entries == 1) { if (entries == 1) {
tmp = xmemrchr((uchar *)g_prefixpath, '/', strlen(g_prefixpath)); tmp = xmemrchr((uchar *)g_prefixpath, '/', strlen(g_prefixpath));


||||||
x
 
000:0
正在加载...
取消
保存