Skip to content
Permalink
Browse files

Merge pull request #2184 from dscho/address-coverity-report

Fix some issues reported by Coverity
  • Loading branch information...
dscho committed May 9, 2019
2 parents 65f1570 + 32b5d74 commit 2ac5f424d8f1ffd02cb4177674fc17e9baf3dab8
Showing with 20 additions and 11 deletions.
  1. +1 −0 add-patch.c
  2. +4 −1 builtin/bisect--helper.c
  3. +2 −1 builtin/rebase--interactive.c
  4. +1 −1 builtin/rebase.c
  5. +4 −2 ci/lib.sh
  6. +5 −4 compat/win32/fscache.c
  7. +1 −1 entry.c
  8. +2 −1 sequencer.c
@@ -218,6 +218,7 @@ static void err(struct add_p_state *s, const char *fmt, ...)
vfprintf(stderr, fmt, args);
fputs(s->s.reset_color, stderr);
fputc('\n', stderr);
va_end(args);
}

static void setup_child_process(struct child_process *cp,
@@ -571,7 +571,10 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout,
write_file(git_path_bisect_start(), "%s\n", start_head.buf);

if (no_checkout) {
get_oid(start_head.buf, &oid);
if (get_oid(start_head.buf, &oid) < 0) {
retval = error(_("invalid ref: '%s'"), start_head.buf);
goto finish;
}
if (update_ref(NULL, "BISECT_HEAD", &oid, NULL, 0,
UPDATE_REFS_MSG_ON_ERR)) {
retval = -1;
@@ -33,7 +33,8 @@ static int get_revision_ranges(const char *upstream, const char *onto,
const char *shortrev;
struct object_id rev_oid;

get_oid(base_rev, &rev_oid);
if (get_oid(base_rev, &rev_oid) < 0)
return error(_("invalid rev '%s'"), base_rev);
shortrev = find_unique_abbrev(&rev_oid, DEFAULT_ABBREV);

*shortrevisions = xstrfmt("%s..%s", shortrev, shorthead);
@@ -848,7 +848,7 @@ static int rebase_config(const char *var, const char *value, void *data)
if (git_config_bool(var, value))
opts->flags |= REBASE_DIFFSTAT;
else
opts->flags &= !REBASE_DIFFSTAT;
opts->flags &= ~REBASE_DIFFSTAT;
return 0;
}

@@ -116,10 +116,12 @@ then
CI_OS_NAME="$(echo "$AGENT_OS" | tr A-Z a-z)"
test darwin != "$CI_OS_NAME" || CI_OS_NAME=osx
CI_REPO_SLUG="$(expr "$BUILD_REPOSITORY_URI" : '.*/\([^/]*/[^/]*\)$')"
jobs=10
if test -n "$MSVC"
then
CC=compat/vcbuild/scripts/clink.pl
jobname=windows-msvc
jobs=4
fi
CC="${CC:-gcc}"

@@ -132,9 +134,9 @@ then
}

BREW_INSTALL_PACKAGES=gcc@8
export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save"
export GIT_PROVE_OPTS="--timer --jobs $jobs --state=failed,slow,save"
export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml"
MAKEFLAGS="$MAKEFLAGS --jobs=10"
MAKEFLAGS="$MAKEFLAGS --jobs=$jobs"
test windows_nt != "$CI_OS_NAME" ||
GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
else
@@ -309,9 +309,8 @@ static struct fsentry *fsentry_create_list(struct fscache *cache, const struct f
return list;

Error:
errno = (status == ERROR_DIRECTORY) ? ENOTDIR : err_win_to_posix(status);
trace_printf_key(&trace_fscache, "fscache: error(%d) unable to query directory contents '%.*s'\n",
errno, dir->len, dir->name);
trace_printf_key(&trace_fscache, "fscache: status(%ld) unable to query directory contents '%.*s'\n",
status, dir->len, dir->name);
CloseHandle(h);
fsentry_release(list);
return NULL;
@@ -454,8 +453,10 @@ int fscache_enable(size_t initial_size)
if (!initialized) {
if (!dwTlsIndex) {
dwTlsIndex = TlsAlloc();
if (dwTlsIndex == TLS_OUT_OF_INDEXES)
if (dwTlsIndex == TLS_OUT_OF_INDEXES) {
LeaveCriticalSection(&fscache_cs);
return 0;
}
}

/* redirect opendir and lstat to the fscache implementations */
@@ -289,7 +289,7 @@ static int write_entry(struct cache_entry *ce,
if (!has_symlinks || to_tempfile)
goto write_file_entry;

ret = create_symlink(state ? state->istate : NULL, new_blob, path);
ret = create_symlink(state->istate, new_blob, path);
free(new_blob);
if (ret)
return error_errno("unable to create symlink %s", path);
@@ -4884,7 +4884,8 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
struct object_id oid;
struct stat st;

get_oid(onto, &oid);
if (get_oid(onto, &oid) < 0)
return error(_("invalid rev: '%s'"), onto);
shortonto = find_unique_abbrev(&oid, DEFAULT_ABBREV);

if (!lstat(todo_file, &st) && st.st_size == 0 &&

0 comments on commit 2ac5f42

Please sign in to comment.
You can’t perform that action at this time.