X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=wrapper.c;h=ea3cf64d4c399ae84c156b850002459a8ffde72c;hb=554544276a604c144df45efcb060c80aa322088c;hp=e4fa9d84cd076770306114ff4f284155a5cdd2a1;hpb=3ae0ac65cff232db66282efa931c0e7e83a60e24;p=thirdparty%2Fgit.git diff --git a/wrapper.c b/wrapper.c index e4fa9d84cd..ea3cf64d4c 100644 --- a/wrapper.c +++ b/wrapper.c @@ -690,3 +690,16 @@ int xgethostname(char *buf, size_t len) buf[len - 1] = 0; return ret; } + +int is_empty_or_missing_file(const char *filename) +{ + struct stat st; + + if (stat(filename, &st) < 0) { + if (errno == ENOENT) + return 1; + die_errno(_("could not stat %s"), filename); + } + + return !st.st_size; +}