Package: mtp-tools
Version: 1.0.3-1
Severity: minor
Tags: patch

This is a reminder for me, the issue was originally reported to Launchpad 
(#620814).

Author: Alessio Treglia <ales...@debian.org>
Description: mtp-connect should not return 0 when something goes wrong.
Ubuntu-Bug: https://launchpad.net/bugs/620814
Forwarded: http://sourceforge.net/support/tracker.php?aid=3050064
---
 examples/connect.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--- libmtp.orig/examples/connect.c
+++ libmtp/examples/connect.c
@@ -28,6 +28,10 @@
 #include "util.h"
 #include "pathutils.h"
 
+#define                ERRNODEVICE             -1
+#define                ERRWRONGARG             1
+#define                ERRUNKNOPT              2
+
 LIBMTP_folder_t *folders;
 LIBMTP_file_t *files;
 LIBMTP_mtpdevice_t *device;
@@ -77,6 +81,8 @@ usage(void)
 
 int main (int argc, char **argv)
 {
+  int ret = 0;
+
   checklang();
 
   LIBMTP_Init();
@@ -86,7 +92,7 @@ int main (int argc, char **argv)
   device = LIBMTP_Get_First_Device();
   if (device == NULL) {
     printf("No devices.\n");
-    return 0;
+    return ERRNODEVICE;
   }
   files = LIBMTP_Get_Filelisting_With_Callback (device, NULL, NULL);
   folders = LIBMTP_Get_Folder_List (device);
@@ -104,7 +110,7 @@ int main (int argc, char **argv)
   } else {
     if ( argc < 2 ) {
       usage ();
-      return 1;
+      return ERRWRONGARG;
     }
 
     while (1) {
@@ -159,11 +165,12 @@ int main (int argc, char **argv)
       while (optind < argc)
         printf("%s ", argv[optind++]);
       printf("\n");
+      ret = ERRUNKNOPT;
     }
   }
 
   LIBMTP_Release_Device(device);
 
-  exit (0);
+  exit (ret);
 }
 


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mtp-tools depends on:
ii  libc6                        2.11.2-2    Embedded GNU C Library: Shared lib
ii  libmtp8                      1.0.3-1     Media Transfer Protocol (MTP) libr
ii  libusb-0.1-4                 2:0.1.12-15 userspace USB programming library

mtp-tools recommends no packages.

mtp-tools suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to