aboutsummaryrefslogtreecommitdiffstats
path: root/cpio/test/test_basic.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpio/test/test_basic.c')
-rw-r--r--cpio/test/test_basic.c60
1 files changed, 45 insertions, 15 deletions
diff --git a/cpio/test/test_basic.c b/cpio/test/test_basic.c
index f3a048002a55..6e45d1856983 100644
--- a/cpio/test/test_basic.c
+++ b/cpio/test/test_basic.c
@@ -144,49 +144,79 @@ DEFINE_TEST(test_basic)
/* File with 10 bytes content. */
assertMakeFile("file", 0644, "1234567890");
fprintf(filelist, "file\n");
- if (is_LargeInode("file"))
+ if (is_LargeInode("file")) {
strncat(result,
- "bsdcpio: file: large inode number truncated: "
- "Numerical result out of range\n",
+ "bsdcpio: file: large inode number truncated: ",
sizeof(result) - strlen(result) -1);
+ strncat(result,
+ strerror(ERANGE),
+ sizeof(result) - strlen(result) -1);
+ strncat(result,
+ "\n",
+ sizeof(result) - strlen(result) -1);
+ }
/* hardlink to above file. */
assertMakeHardlink("linkfile", "file");
fprintf(filelist, "linkfile\n");
- if (is_LargeInode("linkfile"))
+ if (is_LargeInode("linkfile")) {
+ strncat(result,
+ "bsdcpio: linkfile: large inode number truncated: ",
+ sizeof(result) - strlen(result) -1);
+ strncat(result,
+ strerror(ERANGE),
+ sizeof(result) - strlen(result) -1);
strncat(result,
- "bsdcpio: linkfile: large inode number truncated: "
- "Numerical result out of range\n",
+ "\n",
sizeof(result) - strlen(result) -1);
+ }
/* Symlink to above file. */
if (canSymlink()) {
assertMakeSymlink("symlink", "file");
fprintf(filelist, "symlink\n");
- if (is_LargeInode("symlink"))
+ if (is_LargeInode("symlink")) {
+ strncat(result,
+ "bsdcpio: symlink: large inode number truncated: ",
+ sizeof(result) - strlen(result) -1);
strncat(result,
- "bsdcpio: symlink: large inode number truncated: "
- "Numerical result out of range\n",
+ strerror(ERANGE),
sizeof(result) - strlen(result) -1);
+ strncat(result,
+ "\n",
+ sizeof(result) - strlen(result) -1);
+ }
}
/* Another file with different permissions. */
assertMakeFile("file2", 0777, "1234567890");
fprintf(filelist, "file2\n");
- if (is_LargeInode("file2"))
+ if (is_LargeInode("file2")) {
+ strncat(result,
+ "bsdcpio: file2: large inode number truncated: ",
+ sizeof(result) - strlen(result) -1);
+ strncat(result,
+ strerror(ERANGE),
+ sizeof(result) - strlen(result) -1);
strncat(result,
- "bsdcpio: file2: large inode number truncated: "
- "Numerical result out of range\n",
+ "\n",
sizeof(result) - strlen(result) -1);
+ }
/* Directory. */
assertMakeDir("dir", 0775);
fprintf(filelist, "dir\n");
- if (is_LargeInode("dir"))
+ if (is_LargeInode("dir")) {
+ strncat(result,
+ "bsdcpio: dir: large inode number truncated: ",
+ sizeof(result) - strlen(result) -1);
strncat(result,
- "bsdcpio: dir: large inode number truncated: "
- "Numerical result out of range\n",
+ strerror(ERANGE),
sizeof(result) - strlen(result) -1);
+ strncat(result,
+ "\n",
+ sizeof(result) - strlen(result) -1);
+ }
strncat(result, "2 blocks\n", sizeof(result) - strlen(result) -1);
/* All done. */