diff --git a/fast-import.c b/fast-import.c
index 171d1783399c970136d55cf86fdb78b5c4edce65..f0e08aca70c16e9309dde87954593a76ad37b9ef 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
{
const char *orig_src = src;
char *endp, sign;
{
const char *orig_src = src;
char *endp, sign;
+ unsigned long date;
- strtoul(src, &endp, 10);
- if (endp == src || *endp != ' ')
+ errno = 0;
+
+ date = strtoul(src, &endp, 10);
+ if (errno || endp == src || *endp != ' ')
return -1;
src = endp + 1;
return -1;
src = endp + 1;
return -1;
sign = *src;
return -1;
sign = *src;
- strtoul(src + 1, &endp, 10);
- if (endp == src || *endp || (endp - orig_src) >= maxlen)
+ date = strtoul(src + 1, &endp, 10);
+ if (errno || endp == src || *endp || (endp - orig_src) >= maxlen)
return -1;
strcpy(result, orig_src);
return -1;
strcpy(result, orig_src);
if (!p)
die("Corrupt mode: %s", command_buf.buf);
switch (mode) {
if (!p)
die("Corrupt mode: %s", command_buf.buf);
switch (mode) {
+ case 0644:
+ case 0755:
+ mode |= S_IFREG;
case S_IFREG | 0644:
case S_IFREG | 0755:
case S_IFLNK:
case S_IFGITLINK:
case S_IFREG | 0644:
case S_IFREG | 0755:
case S_IFLNK:
case S_IFGITLINK:
- case 0644:
- case 0755:
/* ok */
break;
default:
/* ok */
break;
default:
typename(type), command_buf.buf);
}
typename(type), command_buf.buf);
}
- tree_content_set(&b->branch_tree, p, sha1, S_IFREG | mode, NULL);
+ tree_content_set(&b->branch_tree, p, sha1, mode, NULL);
}
static void file_change_d(struct branch *b)
}
static void file_change_d(struct branch *b)