svn commit: r350452 - projects/fuse2/tests/sys/fs/fusefs
Alan Somers
asomers at FreeBSD.org
Tue Jul 30 17:31:10 UTC 2019
Author: asomers
Date: Tue Jul 30 17:31:09 2019
New Revision: 350452
URL: https://svnweb.freebsd.org/changeset/base/350452
Log:
fusefs: nul-terminate some strings in the readdir test
Reported by: GCC 8
Sponsored by: The FreeBSD Foundation
Modified:
projects/fuse2/tests/sys/fs/fusefs/readdir.cc
Modified: projects/fuse2/tests/sys/fs/fusefs/readdir.cc
==============================================================================
--- projects/fuse2/tests/sys/fs/fusefs/readdir.cc Tue Jul 30 17:18:31 2019 (r350451)
+++ projects/fuse2/tests/sys/fs/fusefs/readdir.cc Tue Jul 30 17:31:09 2019 (r350452)
@@ -70,19 +70,19 @@ TEST_F(Readdir, dots)
struct dirent *de;
vector<struct dirent> ents(2);
vector<struct dirent> empty_ents(0);
- const char *dot = ".";
- const char *dotdot = "..";
+ const char dot[] = ".";
+ const char dotdot[] = "..";
expect_lookup(RELPATH, ino);
expect_opendir(ino);
ents[0].d_fileno = 2;
ents[0].d_off = 2000;
- ents[0].d_namlen = strlen(dotdot);
+ ents[0].d_namlen = sizeof(dotdot);
ents[0].d_type = DT_DIR;
strncpy(ents[0].d_name, dotdot, ents[0].d_namlen);
ents[1].d_fileno = 3;
ents[1].d_off = 3000;
- ents[1].d_namlen = strlen(dot);
+ ents[1].d_namlen = sizeof(dot);
ents[1].d_type = DT_DIR;
strncpy(ents[1].d_name, dot, ents[1].d_namlen);
expect_readdir(ino, 0, ents);
@@ -102,8 +102,8 @@ TEST_F(Readdir, dots)
*/
//EXPECT_EQ(2000, de->d_off);
EXPECT_EQ(DT_DIR, de->d_type);
- EXPECT_EQ(2, de->d_namlen);
- EXPECT_EQ(0, strcmp("..", de->d_name));
+ EXPECT_EQ(sizeof(dotdot), de->d_namlen);
+ EXPECT_EQ(0, strcmp(dotdot, de->d_name));
errno = 0;
de = readdir(dir);
@@ -111,8 +111,8 @@ TEST_F(Readdir, dots)
EXPECT_EQ(3ul, de->d_fileno);
//EXPECT_EQ(3000, de->d_off);
EXPECT_EQ(DT_DIR, de->d_type);
- EXPECT_EQ(1, de->d_namlen);
- EXPECT_EQ(0, strcmp(".", de->d_name));
+ EXPECT_EQ(sizeof(dot), de->d_namlen);
+ EXPECT_EQ(0, strcmp(dot, de->d_name));
ASSERT_EQ(nullptr, readdir(dir));
ASSERT_EQ(0, errno);
More information about the svn-src-projects
mailing list