aboutsummaryrefslogtreecommitdiff
path: root/src/tools/mac/symupload/symupload.m
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/mac/symupload/symupload.m')
-rw-r--r--src/tools/mac/symupload/symupload.m30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/tools/mac/symupload/symupload.m b/src/tools/mac/symupload/symupload.m
index fe413458..a7cce7b0 100644
--- a/src/tools/mac/symupload/symupload.m
+++ b/src/tools/mac/symupload/symupload.m
@@ -38,6 +38,8 @@
// cpu: the CPU that the module was built for (x86 or ppc)
// symbol_file: the contents of the breakpad-format symbol file
+#include <fcntl.h>
+#include <sys/stat.h>
#include <unistd.h>
#include <Foundation/Foundation.h>
@@ -82,15 +84,6 @@ static NSArray *ModuleDataForSymbolFile(NSString *file) {
}
//=============================================================================
-static NSString *CompactIdentifier(NSString *uuid) {
- NSMutableString *str = [NSMutableString stringWithString:uuid];
- [str replaceOccurrencesOfString:@"-" withString:@"" options:0
- range:NSMakeRange(0, [str length])];
-
- return str;
-}
-
-//=============================================================================
static void Start(Options *options) {
NSURL *url = [NSURL URLWithString:options->uploadURLStr];
HTTPMultipartUpload *ul = [[HTTPMultipartUpload alloc] initWithURL:url];
@@ -174,6 +167,25 @@ SetupOptions(int argc, const char *argv[], Options *options) {
exit(1);
}
+ int fd = open(argv[optind], O_RDONLY);
+ if (fd < 0) {
+ fprintf(stderr, "%s: %s: %s\n", argv[0], argv[optind], strerror(errno));
+ exit(1);
+ }
+
+ struct stat statbuf;
+ if (fstat(fd, &statbuf) < 0) {
+ fprintf(stderr, "%s: %s: %s\n", argv[0], argv[optind], strerror(errno));
+ close(fd);
+ exit(1);
+ }
+ close(fd);
+
+ if (!S_ISREG(statbuf.st_mode)) {
+ fprintf(stderr, "%s: %s: not a regular file\n", argv[0], argv[optind]);
+ exit(1);
+ }
+
options->symbolsPath = [NSString stringWithUTF8String:argv[optind]];
options->uploadURLStr = [NSString stringWithUTF8String:argv[optind + 1]];
}