From fd48fe88955712e852fc84d9c88ccf8d67454b61 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 26 Feb 2008 12:00:02 -0500 Subject: [PATCH] Check and make sure we have a valid file before continuing * Source/AppController.m: ([AppController uploadAndPrint:]) --- Source/AppController.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/AppController.m b/Source/AppController.m index 2d5f415..f6b3fb8 100644 --- a/Source/AppController.m +++ b/Source/AppController.m @@ -126,6 +126,11 @@ struct hostent *host = gethostbyname("acs.bu.edu"); memcpy(&sin.sin_addr, host->h_addr_list[0], host->h_length); + if (stat([[dragRegion filePath] UTF8String], &fileInfo)) + { + return [self setStatus:@"Invalid file selected" isError:YES]; + } + if (connect(sock, (struct sockaddr *)(&sin), sizeof(struct sockaddr_in)) != 0) { return [self setStatus:@"Could not connect to acs.bu.edu" isError:YES]; @@ -148,8 +153,6 @@ goto shutdown; } - stat([[dragRegion filePath] UTF8String], &fileInfo); - LIBSSH2_CHANNEL *channel = libssh2_scp_send(ssh, "~/__bu_print_drop__.pdf", 0755, (unsigned long)fileInfo.st_size); if (!channel) { -- 2.43.5