[PATCH] android/pan: Generate file path in compile time

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

 



This reduce need of using snprintf function and removes need of manual
buffer size calculation.
---
 android/pan.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/android/pan.c b/android/pan.c
index 205da71..dfd7762 100644
--- a/android/pan.c
+++ b/android/pan.c
@@ -50,9 +50,9 @@
 #include "bluetooth.h"
 
 #define SVC_HINT_NETWORKING 0x02
-#define BNEP_BRIDGE	"bnep"
-#define FORWARD_DELAY_PATH	"/sys/class/net/%s/bridge/forward_delay"
-#define DELAY_PATH_MAX	41
+
+#define BNEP_BRIDGE "bnep"
+#define FORWARD_DELAY_PATH "/sys/class/net/"BNEP_BRIDGE"/bridge/forward_delay"
 
 static bdaddr_t adapter_addr;
 GSList *devices = NULL;
@@ -470,11 +470,8 @@ failed:
 static int set_forward_delay(void)
 {
 	int fd, ret;
-	char path[DELAY_PATH_MAX];
-
-	snprintf(path, sizeof(path), FORWARD_DELAY_PATH, BNEP_BRIDGE);
 
-	fd = open(path, O_RDWR);
+	fd = open(FORWARD_DELAY_PATH, O_RDWR);
 	if (fd < 0)
 		return -errno;
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux