Linux bluetooth development
 help / color / mirror / Atom feed
From: Konrad Zapalowicz <konrad.zapalowicz@canonical.com>
To: marcel@holtmann.org
Cc: luiz.von.dentz@intel.com, linux-bluetooth@vger.kernel.org,
	"Konrad Zapałowicz" <konrad.zapalowicz@canonical.com>
Subject: [PATCH] core: replace sizeof(filename) with PATH_MAX
Date: Fri, 31 Mar 2017 13:03:57 +0200	[thread overview]
Message-ID: <1490958237-9299-1-git-send-email-bergo.torino@gmail.com> (raw)

From: Konrad Zapałowicz <konrad.zapalowicz@canonical.com>

This commit replaces sizeof(filename) with PATH_MAX to match the common
scheme which is used in other places.

Signed-off-by: Konrad Zapałowicz <konrad.zapalowicz@canonical.com>
---
 src/adapter.c     | 2 +-
 src/shared/util.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 3dac7d6..3935460 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -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();
diff --git a/src/shared/util.c b/src/shared/util.c
index 7878552..4b59fad 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -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;
 
-- 
2.7.4

             reply	other threads:[~2017-03-31 11:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 11:03 Konrad Zapalowicz [this message]
2017-03-31 11:21 ` [PATCH] core: replace sizeof(filename) with PATH_MAX Bastien Nocera
2017-03-31 11:32   ` Konrad Zapalowicz
2017-03-31 14:00     ` Von Dentz, Luiz
2017-03-31 14:15       ` Konrad Zapalowicz
2017-03-31 14:44 ` [PATCH v2] " Konrad Zapalowicz
2017-04-03 11:08   ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490958237-9299-1-git-send-email-bergo.torino@gmail.com \
    --to=konrad.zapalowicz@canonical.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.von.dentz@intel.com \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox