summaryrefslogtreecommitdiff
path: root/tbdiff-deploy
diff options
context:
space:
mode:
authorBen Brewer <ben.brewer@codethink.co.uk>2014-05-30 17:22:53 +0100
committerBen Brewer <ben.brewer@codethink.co.uk>2014-06-04 12:44:01 +0100
commit2d580135f11a1e705949b7fcf69486bacbca5587 (patch)
treed81e3ac2af646553fcc4b28877199655e76fd85b /tbdiff-deploy
parentcbe6a4f51bc27c4e8a81f89876c3ae469c8bf67e (diff)
downloadtbdiff-2d580135f11a1e705949b7fcf69486bacbca5587.tar.gz
Use POSIX file operations for tbdiff-apply
For the consistency reasons listed in earlier commits.
Diffstat (limited to 'tbdiff-deploy')
-rw-r--r--tbdiff-deploy/main.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tbdiff-deploy/main.c b/tbdiff-deploy/main.c
index b5b7ce9..3f7691c 100644
--- a/tbdiff-deploy/main.c
+++ b/tbdiff-deploy/main.c
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
+#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
@@ -33,19 +34,19 @@ main(int argc,
return EXIT_FAILURE;
}
- FILE* patch = fopen(argv[1], "rb");
- if(patch == NULL) {
+ int patch = open(argv[1], O_RDONLY);
+ if(patch < 0) {
fprintf(stderr, "Error: Can't open patch stream for reading.\n");
return EXIT_FAILURE;
}
int err;
if((err = tbd_apply(patch)) != 0) {
- fclose(patch);
+ close(patch);
fprintf(stderr, "Error: Error applying patch stream (err=%d).\n", err);
return EXIT_FAILURE;
}
- fclose(patch);
+ close(patch);
return EXIT_SUCCESS;
}