memset(&gpg, 0, sizeof(gpg));
gpg.argv = args_gpg;
gpg.in = -1;
- gpg.out = 1;
args_gpg[2] = path;
- if (start_command(&gpg))
+ if (start_command(&gpg)) {
+ unlink(path);
return error("could not run gpg.");
+ }
write_in_full(gpg.in, buf, len);
close(gpg.in);