Skip to content

Commit 8b4aee0

Browse files
tschwingegitster
authored andcommitted
Don't rely on unspecified behavior
Calling access(p, m) with p == NULL is not specified, so don't do that. On GNU/Hurd systems doing so will result in a SIGSEGV. Signed-off-by: Thomas Schwinge <tschwinge@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 1207510 commit 8b4aee0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin-add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void fill_directory(struct dir_struct *dir, const char **pathspec,
6060
path = git_path("info/exclude");
6161
if (!access(path, R_OK))
6262
add_excludes_from_file(dir, path);
63-
if (!access(excludes_file, R_OK))
63+
if (excludes_file != NULL && !access(excludes_file, R_OK))
6464
add_excludes_from_file(dir, excludes_file);
6565
}
6666

0 commit comments

Comments
 (0)