summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangho Park <sangho1206.park@samsung.com>2014-03-28 02:19:03 -0700
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2014-03-28 02:19:03 -0700
commit2c9176bba2032db0705171529204392d4bcac37f (patch)
tree9d4f64517f5664fedb58ef087cabfc84d5e53406
parent5b0155f7f97de5bf8ab2967df71e1923e1b06baf (diff)
parent1d8c23a8c77c759bec9698f7fe09c01d91522c1c (diff)
downloadqemu-2c9176bba2032db0705171529204392d4bcac37f.tar.gz
qemu-2c9176bba2032db0705171529204392d4bcac37f.tar.bz2
qemu-2c9176bba2032db0705171529204392d4bcac37f.zip
Merge "osutil: improve error handling" into tizen
-rw-r--r--tizen/src/osutil-linux.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/tizen/src/osutil-linux.c b/tizen/src/osutil-linux.c
index 39bcf5b416..c6b3e67c2c 100644
--- a/tizen/src/osutil-linux.c
+++ b/tizen/src/osutil-linux.c
@@ -1,7 +1,7 @@
/*
* Emulator
*
- * Copyright (C) 2012, 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (C) 2012 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
* SeokYeon Hwang <syeon.hwang@samsung.com>
@@ -280,30 +280,31 @@ static int get_auto_proxy(char *http_proxy, char *https_proxy, char *ftp_proxy,
char buf[MAXLEN];
output = popen(gproxycmds[GNOME_PROXY_AUTOCONFIG_URL][gproxytool], "r");
- if(fscanf(output, "%s", buf) > 0) {
+ if (fscanf(output, "%s", buf) > 0) {
process_string(buf);
INFO("pac address: %s\n", buf);
download_url(buf);
}
+
pclose(output);
fp_pacfile = fopen(pac_tempfile, "r");
- if(fp_pacfile != NULL) {
- while(fgets(line, MAXLEN, fp_pacfile) != NULL) {
- if( (strstr(line, "return") != NULL) && (strstr(line, "if") == NULL)) {
+ if (fp_pacfile != NULL) {
+ while (fgets(line, MAXLEN, fp_pacfile) != NULL) {
+ if ((strstr(line, "return") != NULL) && (strstr(line, "if") == NULL)) {
INFO("line found %s", line);
sscanf(line, "%*[^\"]\"%s %s", type, proxy);
}
}
- if(g_str_has_prefix(type, DIRECT)) {
+ if (g_str_has_prefix(type, DIRECT)) {
INFO("auto proxy is set to direct mode\n");
fclose(fp_pacfile);
- }
- else if(g_str_has_prefix(type, PROXY)) {
+ } else if (g_str_has_prefix(type, PROXY)) {
INFO("auto proxy is set to proxy mode\n");
INFO("type: %s, proxy: %s\n", type, proxy);
+
p = strtok(proxy, "\";");
- if(p != NULL) {
+ if (p != NULL) {
INFO("auto proxy to set: %s\n",p);
strcpy(http_proxy, p);
strcpy(https_proxy, p);
@@ -311,19 +312,19 @@ static int get_auto_proxy(char *http_proxy, char *https_proxy, char *ftp_proxy,
strcpy(socks_proxy, p);
}
fclose(fp_pacfile);
- }
- else
- {
+ } else {
ERR("pac file is not wrong! It could be the wrong pac address or pac file format\n");
fclose(fp_pacfile);
}
- }
- else {
+ } else {
ERR("fail to get pacfile fp\n");
- return -1;
+ return -1;
+ }
+
+ if (remove(pac_tempfile) < 0) {
+ WARN("fail to remove the temporary pacfile\n");
}
- remove(pac_tempfile);
return 0;
}