Convert the index file reading/writing to use network byte order.
[git.git] / read-tree.c
index 9aec97f..5c6588d 100644 (file)
@@ -13,8 +13,8 @@ static int read_one_entry(unsigned char *sha1, const char *base, int baselen, co
 
        memset(ce, 0, size);
 
-       ce->st_mode = mode;
-       ce->namelen = baselen + len;
+       ce->ce_mode = htonl(mode);
+       ce->ce_namelen = htons(baselen + len);
        memcpy(ce->name, base, baselen);
        memcpy(ce->name + baselen, pathname, len+1);
        memcpy(ce->sha1, sha1, 20);