From cd8e32577971cf6d8131408951385de8fbbcc3e5 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Fri, 10 Jan 2014 16:09:06 +0100 Subject: [PATCH] android/pan: Generate file path in compile time 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 205da71d2..dfd77621c 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; -- 2.47.3