Imported Upstream version 2.14.3
[platform/upstream/git.git] / git-compat-util.h
index 7d2c0ca..bf4869d 100644 (file)
@@ -900,9 +900,11 @@ static inline char *xstrdup_or_null(const char *str)
 
 static inline size_t xsize_t(off_t len)
 {
-       if (len > (size_t) len)
+       size_t size = (size_t) len;
+
+       if (len != (off_t) size)
                die("Cannot handle files this big");
-       return (size_t)len;
+       return size;
 }
 
 __attribute__((format (printf, 3, 4)))