diff options
author | Jiang Xin <worldhello.net@gmail.com> | 2021-10-30 09:34:30 +0800 |
---|---|---|
committer | Jiang Xin <worldhello.net@gmail.com> | 2021-10-30 09:34:30 +0800 |
commit | cd9ef9ce67bf2934845a6a76a1ecdbc9a5f7a6e0 (patch) | |
tree | ba34cf45622ddcd8e9d250a048661a7e6a8a35ee /compat/mmap.c | |
parent | Merge branch 'master' of github.com:nafmo/git-l10n-sv (diff) | |
parent | Git 2.34-rc0 (diff) | |
download | tgif-cd9ef9ce67bf2934845a6a76a1ecdbc9a5f7a6e0.tar.xz |
Merge branch 'master' of github.com:git/git
* 'master' of github.com:git/git: (762 commits)
Git 2.34-rc0
wrapper: remove xunsetenv()
log: document --encoding behavior on iconv() failure
Revert "logmsg_reencode(): warn when iconv() fails"
completion: fix incorrect bash/zsh string equality check
add, rm, mv: fix bug that prevents the update of non-sparse dirs
git-bundle.txt: add missing words and punctuation
Documentation/Makefile: fix lint-docs mkdir dependency
submodule: drop unused sm_name parameter from append_fetch_remotes()
The fifteenth batch
gitweb.txt: change "folder" to "directory"
gitignore.txt: change "folder" to "directory"
git-multi-pack-index.txt: change "folder" to "directory"
git.txt: fix typo
archive: describe compression level option
config.txt: fix typo
command-list.txt: remove 'sparse-index' from main help
userdiff-cpp: back out the digit-separators in numbers
submodule--helper: fix incorrect newlines in an error message
branch (doc): -m/-c copies config and reflog
...
Diffstat (limited to 'compat/mmap.c')
-rw-r--r-- | compat/mmap.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compat/mmap.c b/compat/mmap.c index 14d31010df..8d6c02d4bc 100644 --- a/compat/mmap.c +++ b/compat/mmap.c @@ -7,7 +7,12 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of if (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ) die("Invalid usage of mmap when built with NO_MMAP"); - start = xmalloc(length); + if (length == 0) { + errno = EINVAL; + return MAP_FAILED; + } + + start = malloc(length); if (start == NULL) { errno = ENOMEM; return MAP_FAILED; |