Erik Faye-Lund wrote: > We also seem to depend quite heavily on errno being preserved on > non-errors some places around in the code. Hmm, sounds worrying. - builtin/fetch.c::s_update_ref appears to have some of this kind of bogosity. - safe_create_leading_directories_const and git_config_set_multivar let free() touch errno. Probably not a problem. - lock_file ought to preserve or set errno on failure. - daemon::run_service sometimes sets errno on failure and sometimes not. This is confusing even if callers don't seem to care. - fast-import::dump_marks_helper ought to do its own error reporting. - resolve_ref seems to rely on get_packed_refs not to clobber errno. - sha1_file::open_packed_git_1 seems to rely on unuse_one_window not to clobber errno. Aside from that: The following does not take into account correctness of error messages. (That is probably a good reason to fix compat/mingw's opendir. Sorry, I forgot to take that into account before.) Builtins -------- apply.c: checks errno following lstat() failure. checks errno following try_create_file() return from mkdir(), symlink(), or open() failure. clone.c: checks errno following mkdir() and unlink() failure. commit.c: saves errno following strbuf_read_file() failure. fetch.c: checks errno following write_in_full(), close(), fopen() failure. see above for the s_update_ref() checks. for-each-ref.c: checks errno following strtol() failure. grep.c: checks errno following open() and lstat() failure. index-pack.c: checks errno following open() failure. checks errno following odb_pack_keep() [= open()] failure. init-db.c: checks errno following mkdir(), lstat() failure. log.c: checks errno following mkdir() failure. mailsplit.c: checks errno following opendir() failure. pack-objects.c: checks errno following fgets() failure. rm.c: checks errno following lstat() failure. update-index.c: checks errno following lstat() failure. relies on strtoul() not to clobber errno on success. checks errno following hold_locked_index() return from lock_file() failure (see above). upload-archive.c: checks errno following read(), pipe(), fork(), and poll() failure. Compatibility routines ---------------------- cygwin.c, inet_ntop.c, mingw.c, and mmap.c use errno in noncosmetic ways. I haven't checked them. git wrapper ----------- git.c: checks errno following run_command_v_opt() failure. libgit ------ config.c: checks errno following open() failure, with intervening free(). connect.c: checks errno following connect(), socket() failure. copy.c: saves errno following xread(), xwrite() failure. daemon.c: checks errno following poll(), accept() failure. diff-lib.c: checks errno following lstat() failure. diff.c: checks errno following lstat() failure. dir.c: checks errno following unlink() failure. entry.c: checks errno following mkdir() failure. fast-import.c: saves errno following fdopen(), fprintf(), fclose() failure. saves errno following commit_lock_file [=close() or rename()] failure. relies on strtoul() not to clobber errno on success. git-compat-util.h: relies on strtoul(), strtol() not to clobber errno on success. http.c: checks errno following open() failure. lockfile.c: checks errno following open() failure. merge-recursive.c: checks errno following write_in_full(), unlink() failure. path.c: checks errno following snprintf() failure. read-cache.c: checks errno following lstat(), open() failure. refs.c: see above for resolve_ref() worries. rerere.c: checks errno following fwrite(), unlink() failure. run-command.c: checks errno following waitpid, pipe, fork, execv, failure. wait_or_whine() does not set errno when child died by signal. setup.c: checks errno following lstat() failure. sha1_file.c: checks errno following open(), opendir() failure. see above re unuse_one_window() failure. sha1_name.c: checks errno following lstat() failure. strbuf.c: checks errno following readlink() failure. symlinks.c: checks errno following stat(), lstat() failure. transport-helper.c: checks errno following start_command() failure. unpack-trees.c: checks errno following lstat() failure. upload-pack.c: checks errno following poll() failure. utf8.c: checks errno following iconv() failure. wrapper.c: checks errno following read(), write(), unlink(), rmdir() failure. write_or_die.c: checks errno following fflush(), write() failures. Test helpers ------------ test-run-command.c: checks errno following start_command() failure. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html