summaryrefslogtreecommitdiff
path: root/src/linux/up-input.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2020-11-05 16:13:43 +0100
committerBastien Nocera <hadess@hadess.net>2020-11-05 16:13:43 +0100
commit522fb6fff29ec22205b856d076605f58b1d7172a (patch)
tree765ff06583f1f56608c0062c803275ed1cd40d23 /src/linux/up-input.c
parent47481f3a57aeffa140f34e13f8a003b0b094af03 (diff)
downloadupower-522fb6fff29ec22205b856d076605f58b1d7172a.tar.gz
linux: Don't throw debug errors unless needed
It's really confusing seeing "not a switch [...]" when we actually managed to find a switch, so throw 2 errors in the debug when both checks fail, rather than as things are being tested.
Diffstat (limited to 'src/linux/up-input.c')
-rw-r--r--src/linux/up-input.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/linux/up-input.c b/src/linux/up-input.c
index 565f11e..3408714 100644
--- a/src/linux/up-input.c
+++ b/src/linux/up-input.c
@@ -182,13 +182,16 @@ up_input_coldplug (UpInput *input, GUdevDevice *d)
/* is a switch */
path = g_build_filename (native_path, "../capabilities/sw", NULL);
if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
- g_debug ("not a switch [%s]", path);
- g_free (path);
- path = g_build_filename (native_path, "capabilities/sw", NULL);
- if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
+ char *path2;
+ path2 = g_build_filename (native_path, "capabilities/sw", NULL);
+ if (!g_file_test (path2, G_FILE_TEST_EXISTS)) {
g_debug ("not a switch [%s]", path);
+ g_debug ("not a switch [%s]", path2);
+ g_free (path2);
goto out;
}
+ g_free (path);
+ path = path2;
}
/* get caps */