summaryrefslogtreecommitdiff
path: root/libgphoto2_port/libgphoto2_port
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2007-10-29 05:23:49 +0000
committerDan Fandrich <dan@coneharvesters.com>2007-10-29 05:23:49 +0000
commitae2ee96e355f06799b967a919ee1d3165254c1ce (patch)
treea938d0bbf2cf7bea15a412d1bc5f9d2f93f1882e /libgphoto2_port/libgphoto2_port
parent5255d802102c10f971dc98f10828451d9922340d (diff)
downloadlibgphoto2-ae2ee96e355f06799b967a919ee1d3165254c1ce.tar.gz
* libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c: Be
more resiliant in case of errors enumerating a port library. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@10838 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2_port/libgphoto2_port')
-rw-r--r--libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c
index 0a12fe19b..a7358a63e 100644
--- a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c
+++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c
@@ -237,17 +237,22 @@ foreach_func (const char *filename, lt_ptr data)
gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list",
_("Could not load port driver list: '%s'."),
gp_port_result_as_string (result));
- return (0);
}
- list->iolib_count++;
+ if (old_size != list->count) {
+ /*
+ * It doesn't matter if lib_list returned a failure code,
+ * at least some entries were added
+ */
+ list->iolib_count++;
- for (j = old_size; j < list->count; j++){
- gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list",
- _("Loaded '%s' ('%s') from '%s'."),
- list->info[j].name, list->info[j].path,
- filename);
- strcpy (list->info[j].library_filename, filename);
+ for (j = old_size; j < list->count; j++){
+ gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list",
+ _("Loaded '%s' ('%s') from '%s'."),
+ list->info[j].name, list->info[j].path,
+ filename);
+ strcpy (list->info[j].library_filename, filename);
+ }
}
return (0);
@@ -473,11 +478,11 @@ gp_port_info_list_get_info (GPPortInfoList *list, int n, GPPortInfo *info)
/* Ignore generic entries */
for (i = 0; i <= n; i++)
- if (!strlen (list->info[i].name))
+ if (!strlen (list->info[i].name)) {
n++;
-
- if (n >= list->count)
- return (GP_ERROR_BAD_PARAMETERS);
+ if (n >= list->count)
+ return (GP_ERROR_BAD_PARAMETERS);
+ }
memcpy (info, &(list->info[n]), sizeof (GPPortInfo));