From 8923485d74efbaa2bfd67f8055e4cacd88d13e5d Mon Sep 17 00:00:00 2001 From: Lutz Mueller Date: Wed, 3 Oct 2001 13:42:58 +0000 Subject: [PATCH] =?UTF-8?q?2001-10-03=20=20Lutz=20M=EF=BF=BDller=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * serial/unix.c: Correctly interpret the return value of dev_[un]lock git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@2364 67ed7778-7388-44ab-90cf-0a291f65f57c --- libgphoto2_port/ChangeLog | 4 ++++ libgphoto2_port/serial/unix.c | 22 ++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/libgphoto2_port/ChangeLog b/libgphoto2_port/ChangeLog index 9a770aa9f..643e60555 100644 --- a/libgphoto2_port/ChangeLog +++ b/libgphoto2_port/ChangeLog @@ -1,3 +1,7 @@ +2001-10-03 Lutz Müller + + * serial/unix.c: Correctly interpret the return value of dev_[un]lock + 2001-10-03 Lutz Müller * test/gphoto2-port-test.c: Renamed into diff --git a/libgphoto2_port/serial/unix.c b/libgphoto2_port/serial/unix.c index 10576f1bc..c51cd54cc 100644 --- a/libgphoto2_port/serial/unix.c +++ b/libgphoto2_port/serial/unix.c @@ -143,8 +143,15 @@ gp_port_serial_lock (gp_port *dev, const char *port) if (!pid) return (GP_OK); - gp_port_debug_printf (GP_DEBUG_LOW, dev->debug_level, "Device '%s' is " - "locked by pid %d.", port, pid); + /* Tell the user what went wrong */ + if (pid > 0) + gp_port_debug_printf (GP_DEBUG_LOW, dev->debug_level, "Device " + "'%s' is locked by pid %d.", port, pid); + else + gp_port_debug_printf (GP_DEBUG_LOW, dev->debug_level, + "dev_lock on '%s' returned %d.", + port, pid); + return (GP_ERROR_IO_LOCK); #else /* !HAVE_LOCKDEV */ @@ -291,8 +298,15 @@ gp_port_serial_unlock (gp_port *dev) if (!pid) return (GP_OK); - gp_port_debug_printf (GP_DEBUG_LOW, dev->debug_level, "Device '%s' is " - "locked by pid %d.", port, pid); + /* Tell the user what went wrong */ + if (pid > 0) + gp_port_debug_printf (GP_DEBUG_LOW, dev->debug_level, "Device " + "'%s' is locked by pid %d.", port, pid); + else + gp_port_debug_printf (GP_DEBUG_LOW, dev->debug_level, + "dev_unlock on '%s' returned %d.", + port, pid); + return (GP_ERROR_IO_LOCK); #else /* !HAVE_LOCKDEV */