+ memset(buf, 0, 4096);
+ fd = open(argv[optind], O_RDWR | O_CREAT, 0600);
+ if (fd == -1) {
+ printf("Error opening %s\n", argv[1]);
+ exit(1);
+ }
+
+ /* Even 0 bytes, write at least once */
+ if (limit_write) {
+ do {
+ per_write = bytes > 4096 ? 4096 : bytes;
+ rc = write(fd, buf, per_write);
+ if (rc > 0)
+ bytes -= rc;
+ else if (rc < 0)
+ break;
+ } while (bytes > 0);