[gvfs/mtp-backend: 46/64] MTP: do_query_info: Handle filename starting with digits.



commit ec7a65a6a6fcb22fa306cdf46cd9cde3fe33f1a3
Author: Philip Langdale <philipl overt org>
Date:   Mon Nov 12 20:58:12 2012 -0800

    MTP: do_query_info: Handle filename starting with digits.
    
    Make sure that a file isn't named starting with valid digits before
    deciding whether a name based lookup is necessary.

 daemon/gvfsbackendmtp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsbackendmtp.c b/daemon/gvfsbackendmtp.c
index 46cc913..ac0f350 100644
--- a/daemon/gvfsbackendmtp.c
+++ b/daemon/gvfsbackendmtp.c
@@ -829,7 +829,9 @@ do_query_info (GVfsBackend *backend,
     }
   } else {
     LIBMTP_file_t *file = NULL;
-    if (strtol (elements[ne-1], NULL, 10) == 0) {
+    char *endptr;
+    if (strtol (elements[ne-1], &endptr, 10) == 0 ||
+        *endptr != '\0') {
       DEBUG ("(II) try get files and folders");
       int parent_id = -1;
       if (ne > 3) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]