diff options
Diffstat (limited to 'tools/plistutil.c')
| -rw-r--r-- | tools/plistutil.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/plistutil.c b/tools/plistutil.c index 7652bdc..a1a8c9c 100644 --- a/tools/plistutil.c +++ b/tools/plistutil.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <stdlib.h> | 27 | #include <stdlib.h> |
| 28 | #include <string.h> | 28 | #include <string.h> |
| 29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
| 30 | #include <errno.h> | ||
| 30 | 31 | ||
| 31 | #ifdef _MSC_VER | 32 | #ifdef _MSC_VER |
| 32 | #pragma warning(disable:4996) | 33 | #pragma warning(disable:4996) |
| @@ -124,14 +125,18 @@ int main(int argc, char *argv[]) | |||
| 124 | // read input file | 125 | // read input file |
| 125 | iplist = fopen(options->in_file, "rb"); | 126 | iplist = fopen(options->in_file, "rb"); |
| 126 | if (!iplist) { | 127 | if (!iplist) { |
| 128 | printf("ERROR: Could not open input file '%s': %s\n", options->in_file, strerror(errno)); | ||
| 127 | free(options); | 129 | free(options); |
| 128 | return 1; | 130 | return 1; |
| 129 | } | 131 | } |
| 130 | 132 | ||
| 131 | stat(options->in_file, &filestats); | 133 | memset(&filestats, '\0', sizeof(struct stat)); |
| 134 | fstat(fileno(iplist), &filestats); | ||
| 132 | 135 | ||
| 133 | if (filestats.st_size < 8) { | 136 | if (filestats.st_size < 8) { |
| 134 | printf("ERROR: Input file is too small to contain valid plist data.\n"); | 137 | printf("ERROR: Input file is too small to contain valid plist data.\n"); |
| 138 | free(options); | ||
| 139 | fclose(iplist); | ||
| 135 | return -1; | 140 | return -1; |
| 136 | } | 141 | } |
| 137 | 142 | ||
| @@ -159,6 +164,7 @@ int main(int argc, char *argv[]) | |||
| 159 | { | 164 | { |
| 160 | FILE *oplist = fopen(options->out_file, "wb"); | 165 | FILE *oplist = fopen(options->out_file, "wb"); |
| 161 | if (!oplist) { | 166 | if (!oplist) { |
| 167 | printf("ERROR: Could not open output file '%s': %s\n", options->out_file, strerror(errno)); | ||
| 162 | free(options); | 168 | free(options); |
| 163 | return 1; | 169 | return 1; |
| 164 | } | 170 | } |
