--- busybox-1.15.1/editors/vi.c.original 2009-09-18 19:29:12.000000000 +0800 +++ busybox-1.15.1/editors/vi.c 2009-09-18 19:29:33.000000000 +0800 @@ -2364,16 +2364,11 @@ return -2; } charcnt = 0; - /* By popular request we do not open file with O_TRUNC, - * but instead ftruncate() it _after_ successful write. - * Might reduce amount of data lost on power fail etc. - */ - fd = open(fn, (O_WRONLY | O_CREAT), 0666); + fd = open(fn, (O_WRONLY | O_CREAT | O_TRUNC), 0666); if (fd < 0) return -1; cnt = last - first + 1; charcnt = full_write(fd, first, cnt); - ftruncate(fd, charcnt); if (charcnt == cnt) { // good write //file_modified = FALSE;