diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/plistutil.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/plistutil.c b/tools/plistutil.c index c7f1a3f..d4bbbbe 100644 --- a/tools/plistutil.c +++ b/tools/plistutil.c | |||
| @@ -143,17 +143,17 @@ int main(int argc, char *argv[]) | |||
| 143 | 143 | ||
| 144 | if (!options->in_file || !strcmp(options->in_file, "-")) | 144 | if (!options->in_file || !strcmp(options->in_file, "-")) |
| 145 | { | 145 | { |
| 146 | read_size = 0; | 146 | read_size = 0; |
| 147 | plist_entire = malloc(sizeof(char) * BUF_SIZE); | 147 | plist_entire = malloc(sizeof(char) * BUF_SIZE); |
| 148 | if(plist_entire == NULL) | 148 | if(plist_entire == NULL) |
| 149 | { | 149 | { |
| 150 | printf("ERROR: Failed to allocate buffer to read from stdin"); | 150 | printf("ERROR: Failed to allocate buffer to read from stdin"); |
| 151 | free(options); | 151 | free(options); |
| 152 | return 1; | 152 | return 1; |
| 153 | } | 153 | } |
| 154 | plist_entire[read_size] = '\0'; | 154 | plist_entire[read_size] = '\0'; |
| 155 | char ch; | 155 | char ch; |
| 156 | while(read(STDIN_FILENO, &ch, 1) > 0) | 156 | while(read(STDIN_FILENO, &ch, 1) > 0) |
| 157 | { | 157 | { |
| 158 | if (read_size >= BUF_SIZE) { | 158 | if (read_size >= BUF_SIZE) { |
| 159 | char *old = plist_entire; | 159 | char *old = plist_entire; |
| @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) | |||
| 171 | } | 171 | } |
| 172 | plist_entire[read_size] = '\0'; | 172 | plist_entire[read_size] = '\0'; |
| 173 | 173 | ||
| 174 | // Not positive we need this, but it doesnt seem to hurt lol | 174 | // Not positive we need this, but it doesnt seem to hurt lol |
| 175 | if(ferror(stdin)) | 175 | if(ferror(stdin)) |
| 176 | { | 176 | { |
| 177 | printf("ERROR: reading from stdin.\n"); | 177 | printf("ERROR: reading from stdin.\n"); |
| @@ -182,15 +182,15 @@ int main(int argc, char *argv[]) | |||
| 182 | 182 | ||
| 183 | if (read_size < 8) { | 183 | if (read_size < 8) { |
| 184 | printf("ERROR: Input file is too small to contain valid plist data.\n"); | 184 | printf("ERROR: Input file is too small to contain valid plist data.\n"); |
| 185 | free(plist_entire); | 185 | free(plist_entire); |
| 186 | free(options); | 186 | free(options); |
| 187 | return 1; | 187 | return 1; |
| 188 | } | 188 | } |
| 189 | } | 189 | } |
| 190 | else | 190 | else |
| 191 | { | 191 | { |
| 192 | // read input file | 192 | // read input file |
| 193 | iplist = fopen(options->in_file, "rb"); | 193 | iplist = fopen(options->in_file, "rb"); |
| 194 | if (!iplist) { | 194 | if (!iplist) { |
| 195 | printf("ERROR: Could not open input file '%s': %s\n", options->in_file, strerror(errno)); | 195 | printf("ERROR: Could not open input file '%s': %s\n", options->in_file, strerror(errno)); |
| 196 | free(options); | 196 | free(options); |
