Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/7bd1fb50c6415a21fae22...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/7bd1fb50c6415a21fae22f7...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/7bd1fb50c6415a21fae22f7bd...
The branch, master has been updated
via 7bd1fb50c6415a21fae22f7bd534894e02b512bf (commit)
from fdaad39a57029971f0663b402d6335527f7a6039 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=7bd1fb50c6415a21fae...
commit 7bd1fb50c6415a21fae22f7bd534894e02b512bf
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Utils: Filename: Squash warning: -Wformat-truncation=
We need to check the snprintf return value, or GCC7 whinges:
warning: ‘snprintf’ output may be truncated before the last
format character [-Wformat-truncation=]
diff --git a/utils/filename.c b/utils/filename.c
index 01a403f..f0e1bb0 100644
--- a/utils/filename.c
+++ b/utils/filename.c
@@ -272,15 +272,19 @@ bool filename_flush_directory(const char *folder, int depth)
parent = opendir(folder);
while ((entry = readdir(parent))) {
- struct stat statbuf;
+ int written;
+ struct stat statbuf;
/* Ignore '.' and '..' */
if (strcmp(entry->d_name, ".") == 0 ||
strcmp(entry->d_name, "..") == 0)
continue;
- snprintf(child, sizeof(child), "%s/%s", folder, entry->d_name);
- child[sizeof(child) - 1] = '\0';
+ written = snprintf(child, sizeof(child), "%s/%s",
+ folder, entry->d_name);
+ if (written == sizeof(child)) {
+ child[sizeof(child) - 1] = '\0';
+ }
if (stat(child, &statbuf) == -1) {
NSLOG(netsurf, INFO, "Unable to stat %s: %s", child,
@@ -383,16 +387,21 @@ bool filename_delete_recursive(char *folder)
parent = opendir(folder);
while ((entry = readdir(parent))) {
+ int written;
+
/* Ignore '.' and '..' */
if (strcmp(entry->d_name, ".") == 0 ||
strcmp(entry->d_name, "..") == 0)
continue;
- snprintf(child, sizeof(child), "%s/%s", folder, entry->d_name);
- child[sizeof(child) - 1] = '\0';
+ written = snprintf(child, sizeof(child), "%s/%s",
+ folder, entry->d_name);
+ if (written == sizeof(child)) {
+ child[sizeof(child) - 1] = '\0';
+ }
if (stat(child, &statbuf) == -1) {
- NSLOG(netsurf, INFO, "Unable to stat %s: %s", child,
+ NSLOG(netsurf, INFO, "Unable to stat %s: %s", child,
strerror(errno));
continue;
}
-----------------------------------------------------------------------
Summary of changes:
utils/filename.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/utils/filename.c b/utils/filename.c
index 01a403f..f0e1bb0 100644
--- a/utils/filename.c
+++ b/utils/filename.c
@@ -272,15 +272,19 @@ bool filename_flush_directory(const char *folder, int depth)
parent = opendir(folder);
while ((entry = readdir(parent))) {
- struct stat statbuf;
+ int written;
+ struct stat statbuf;
/* Ignore '.' and '..' */
if (strcmp(entry->d_name, ".") == 0 ||
strcmp(entry->d_name, "..") == 0)
continue;
- snprintf(child, sizeof(child), "%s/%s", folder, entry->d_name);
- child[sizeof(child) - 1] = '\0';
+ written = snprintf(child, sizeof(child), "%s/%s",
+ folder, entry->d_name);
+ if (written == sizeof(child)) {
+ child[sizeof(child) - 1] = '\0';
+ }
if (stat(child, &statbuf) == -1) {
NSLOG(netsurf, INFO, "Unable to stat %s: %s", child,
@@ -383,16 +387,21 @@ bool filename_delete_recursive(char *folder)
parent = opendir(folder);
while ((entry = readdir(parent))) {
+ int written;
+
/* Ignore '.' and '..' */
if (strcmp(entry->d_name, ".") == 0 ||
strcmp(entry->d_name, "..") == 0)
continue;
- snprintf(child, sizeof(child), "%s/%s", folder, entry->d_name);
- child[sizeof(child) - 1] = '\0';
+ written = snprintf(child, sizeof(child), "%s/%s",
+ folder, entry->d_name);
+ if (written == sizeof(child)) {
+ child[sizeof(child) - 1] = '\0';
+ }
if (stat(child, &statbuf) == -1) {
- NSLOG(netsurf, INFO, "Unable to stat %s: %s", child,
+ NSLOG(netsurf, INFO, "Unable to stat %s: %s", child,
strerror(errno));
continue;
}
--
NetSurf Browser