[Gpredict-svn] SF.net SVN: gpredict:[837] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <aa...@us...> - 2011-06-30 01:46:04
|
Revision: 837
http://gpredict.svn.sourceforge.net/gpredict/?rev=837&view=rev
Author: aa1vs
Date: 2011-06-30 01:45:58 +0000 (Thu, 30 Jun 2011)
Log Message:
-----------
Fix SEGFAULT in tle-update.c when unable to open file for writing in network updates.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/tle-update.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-06-26 16:38:33 UTC (rev 836)
+++ trunk/ChangeLog 2011-06-30 01:45:58 UTC (rev 837)
@@ -1,3 +1,9 @@
+2011-06-29 Charles Suprin <hamaa1vs at gmail.com>
+
+ * src/tle-update.c
+ Fix SEGFAULT in tle-update.c when unable to open file for writing in network updates.
+
+
2011-06-26 Charles Suprin <hamaa1vs at gmail.com>
* src/sat-log.c
Modified: trunk/src/tle-update.c
===================================================================
--- trunk/src/tle-update.c 2011-06-26 16:38:33 UTC (rev 836)
+++ trunk/src/tle-update.c 2011-06-30 01:45:58 UTC (rev 837)
@@ -599,25 +599,28 @@
"cache", G_DIR_SEPARATOR_S,
files[i], NULL);
outfile = g_fopen (locfile, "wb");
- curl_easy_setopt (curl, CURLOPT_WRITEDATA, outfile);
- curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, my_write_func);
+ if (outfile != NULL) {
+ curl_easy_setopt (curl, CURLOPT_WRITEDATA, outfile);
+ curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, my_write_func);
+
+ /* get file */
+ res = curl_easy_perform (curl);
+
+ if (res != CURLE_OK) {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s: Error fetching %s (%s)"),
+ __FUNCTION__, curfile, curl_easy_strerror (res));
+ error = TRUE;
+ }
+ else {
+ sat_log_log (SAT_LOG_LEVEL_MSG,
+ _("%s: Successfully fetched %s"),
+ __FUNCTION__, curfile);
+ success++;
+ }
+ fclose (outfile);
- /* get file */
- res = curl_easy_perform (curl);
-
- if (res != CURLE_OK) {
- sat_log_log (SAT_LOG_LEVEL_ERROR,
- _("%s: Error fetching %s (%s)"),
- __FUNCTION__, curfile, curl_easy_strerror (res));
- error = TRUE;
}
- else {
- sat_log_log (SAT_LOG_LEVEL_MSG,
- _("%s: Successfully fetched %s"),
- __FUNCTION__, curfile);
- success++;
- }
-
/* update progress indicator */
if (!silent && (progress != NULL)) {
@@ -636,7 +639,6 @@
g_free (userconfdir);
g_free (curfile);
g_free (locfile);
- fclose (outfile);
}
curl_easy_cleanup (curl);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|