core: replace sizeof(filename) with PATH_MAX
PATCH 1/1 core: replace sizeof(filename) with PATH_MAX
From: Konrad Zapałowicz <[email protected]>
This commit replaces sizeof(filename) with PATH_MAX to match the common scheme which is used in other places.
--- src/adapter.c | 2 +- src/shared/util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
src/adapter.c +1 -1
@@ -7107,7 +7107,7 @@ static void store_csrk(struct btd_adapter *adapter, const bdaddr_t *peer,ba2str (peer, device_addr); -snprintf (filename,sizeof (filename),STORAGEDIR "/%s/%s/info" , +snprintf (filename,PATH_MAX ,STORAGEDIR "/%s/%s/info" ,adapter_dir (adapter), device_addr); key_file =g_key_file_new ();
src/shared/util.c +1 -1
@@ -117,7 +117,7 @@ unsigned char util_get_dt(const char *parent, const char *name)char filename[PATH_MAX ];struct stat st; -snprintf (filename,sizeof (filename),"%s/%s" , parent, name); +snprintf (filename,PATH_MAX ,"%s/%s" , parent, name);if (lstat (filename, &st) ==0 &&S_ISDIR (st.st_mode))return DT_DIR ;
Signature · 1 line
2.7.4
Quoted 5 lines · Konrad Zapalowicz
From: Konrad Zapałowicz <[email protected]>
This commit replaces sizeof(filename) with
PATH_MAXto match the common
scheme which is used in other places.
I wonder why g_strdup_printf() isn't used instead. Would allow ignoring PATH_MAX.
Quoted 9 lines · Bastien Nocera
Quoted 5 lines · Konrad Zapalowicz
From: Konrad Zapałowicz <[email protected]>
This commit replaces sizeof(filename) with
PATH_MAXto match the common
scheme which is used in other places.I wonder why
g_strdup_printf()isn't used instead. Would allow ignoringPATH_MAX.
I guess it is because it is easier. With g_strdup_printf() one would have to take care about freeing memory. This is not a case with having filename as an atomatic variable.
Hi Konrad,
Quoted 8 lines · Konrad Zapalowicz
Quoted 7 lines · Bastien Nocera
Quoted 5 lines · Konrad Zapalowicz
From: Konrad Zapa=C5=82owicz <[email protected]>
This commit replaces sizeof(filename) with
PATH_MAXto match the common
scheme which is used in other places.
Quoted 6 lines
Quoted 2 lines
I wonder why
g_strdup_printf()isn't used instead. Would allow ignoringPATH_MAX.I guess it is because it is easier. With
g_strdup_printf()one would have to take care about freeing memory. This is not a case with having filename as an atomatic variable.
Patch looks fine, but we don't use Signed-off-by in userspace tree.
Quoted 12 lines · Luiz
Hi Konrad,
Quoted 8 lines · Konrad Zapalowicz
Quoted 7 lines · Bastien Nocera
Quoted 5 lines · Konrad Zapalowicz
From: Konrad Zapałowicz <[email protected]>
This commit replaces sizeof(filename) with
PATH_MAXto match the common
scheme which is used in other places.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I wonder why
g_strdup_printf()isn't used instead. Would allow ignoringPATH_MAX.I guess it is because it is easier. With
g_strdup_printf()one would have to take care about freeing memory. This is not a case with having filename as an atomatic variable.Patch looks fine, but we don't use Signed-off-by in userspace tree
Ok, will resend.
Thanks,
K
PATCH v2 1/1 core: replace sizeof(filename) with PATH_MAX
In reply to Konrad ZapalowiczFrom: Konrad Zapałowicz <[email protected]>
This commit replaces sizeof(filename) with PATH_MAX to match the common scheme which is used in other places.
--- src/adapter.c | 2 +- src/shared/util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
src/adapter.c +1 -1
@@ -7107,7 +7107,7 @@ static void store_csrk(struct btd_adapter *adapter, const bdaddr_t *peer,ba2str (peer, device_addr); -snprintf (filename,sizeof (filename),STORAGEDIR "/%s/%s/info" , +snprintf (filename,PATH_MAX ,STORAGEDIR "/%s/%s/info" ,adapter_dir (adapter), device_addr); key_file =g_key_file_new ();
src/shared/util.c +1 -1
@@ -117,7 +117,7 @@ unsigned char util_get_dt(const char *parent, const char *name)char filename[PATH_MAX ];struct stat st; -snprintf (filename,sizeof (filename),"%s/%s" , parent, name); +snprintf (filename,PATH_MAX ,"%s/%s" , parent, name);if (lstat (filename, &st) ==0 &&S_ISDIR (st.st_mode))return DT_DIR ;
Signature · 1 line
2.7.4
Hi Konrad,
src/adapter.c static void store_csrk(struct btd_adapter *adapter,=
Quoted 14 lines · Konrad Zapalowicz
From: Konrad Zapa=C5=82owicz <[email protected]>
This commit replaces sizeof(filename) with
PATH_MAXto match the common scheme which is used in other places.--- src/adapter.c | 2 +- src/shared/util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)src/adapter.c +0
-0@@ -7107,7 +7107,7 @@ static void store_csrk(struct btd_adapter *adapter,=
const bdaddr_t *peer,
src/adapter.c static void store_csrk(struct btd_adapter *adapter, const bdaddr_t *peer,
Quoted 6 lines
src/adapter.c +1
-1ba2str (peer, device_addr); -snprintf (filename,sizeof (filename),STORAGEDIR "/%s/%s/info" , +snprintf (filename,PATH_MAX ,STORAGEDIR "/%s/%s/info" , adapter_dir(adapter), device_addr=
);
src/shared/util.c unsigned char util_get_dt(const char *parent, const c=
Quoted 7 lines
src/adapter.c +0
-0key_file =3D g_key_file_new();src/shared/util.c +0
-0@@ -117,7 +117,7 @@ unsigned char util_get_dt(const char *parent, const c=
har *name)
Quoted 11 lines
src/shared/util.c +1
-2char filename[PATH_MAX ];struct stat st; -snprintf (filename,sizeof (filename),"%s/%s" , parent, name); +snprintf (filename,PATH_MAX ,"%s/%s" , parent, name); if (lstat(filename, &st) =3D=3D 0 && S_ISDIR(st.st_mode))return DT_DIR ; --2.7.4
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth=
" in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Applied, thanks.
--=20
Luiz Augusto von Dentz