linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] adaptername: Fix passing negative error code to strerror
@ 2012-12-03 14:03 Szymon Janc
  2012-12-03 14:17 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Szymon Janc @ 2012-12-03 14:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This also make error reporting code compliant with convention used.
---
 plugins/adaptername.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugins/adaptername.c b/plugins/adaptername.c
index 018e6f0..179152f 100644
--- a/plugins/adaptername.c
+++ b/plugins/adaptername.c
@@ -288,9 +288,9 @@ static int adaptername_init(void)
 
 	inot_fd = inotify_init();
 	if (inot_fd < 0) {
-		int err = errno;
+		int err = -errno;
 		error("Failed to setup inotify: %s (%d)", strerror(-err), -err);
-		return -err;
+		return err;
 	}
 
 	mask = IN_CLOSE_WRITE;
@@ -301,11 +301,11 @@ static int adaptername_init(void)
 
 	watch_d = inotify_add_watch(inot_fd, MACHINE_INFO_DIR, mask);
 	if (watch_d < 0) {
-		int err = errno;
+		int err = -errno;
 		error("Failed to setup watch for '%s': %s (%d)",
 				MACHINE_INFO_DIR, strerror(-err), -err);
 		close(inot_fd);
-		return -err;
+		return err;
 	}
 
 	data = g_new(struct inotify_data, 1);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-03 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-03 14:03 [PATCH] adaptername: Fix passing negative error code to strerror Szymon Janc
2012-12-03 14:17 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).