2 #include "git-compat-util.h"
5 * Truncate a file to the given size.
7 int cmd__truncate(int argc
, const char **argv
)
14 die("expected filename and size");
16 sz
= strtoumax(argv
[2], &p
, 0);
20 fd
= xopen(argv
[1], O_WRONLY
| O_CREAT
, 0600);
22 if (ftruncate(fd
, (off_t
) sz
) < 0)
23 die_errno("failed to truncate file");