aboutsummaryrefslogtreecommitdiffstats
path: root/src/jailtest/virtual.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/jailtest/virtual.c')
-rw-r--r--src/jailtest/virtual.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/jailtest/virtual.c b/src/jailtest/virtual.c
index 48296fdb1..fcdcf9720 100644
--- a/src/jailtest/virtual.c
+++ b/src/jailtest/virtual.c
@@ -1,3 +1,22 @@
1/*
2 * Copyright (C) 2014-2021 Firejail Authors
3 *
4 * This file is part of firejail project
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*/
1#include "jailtest.h" 20#include "jailtest.h"
2#include <dirent.h> 21#include <dirent.h>
3#include <sys/wait.h> 22#include <sys/wait.h>
@@ -64,7 +83,8 @@ void virtual_test(void) {
64 assert(user_uid); 83 assert(user_uid);
65 int i; 84 int i;
66 85
67 printf(" Virtual dirs: "); fflush(0); 86 int cnt = 0;
87 cnt += printf(" Virtual dirs: "); fflush(0);
68 88
69 for (i = 0; i < files_cnt; i++) { 89 for (i = 0; i < files_cnt; i++) {
70 assert(files[i]); 90 assert(files[i]);
@@ -85,15 +105,21 @@ void virtual_test(void) {
85 FILE *fp = fopen(files[i], "r"); 105 FILE *fp = fopen(files[i], "r");
86 if (fp) 106 if (fp)
87 fclose(fp); 107 fclose(fp);
88 else 108 else {
89 printf("%s, ", dirs[i]); 109 if (cnt == 0)
110 cnt += printf("\n ");
111 cnt += printf("%s, ", dirs[i]);
112 if (cnt > 60)
113 cnt = 0;
114 }
90 fflush(0); 115 fflush(0);
91 exit(0); 116 exit(cnt);
92 } 117 }
93 118
94 // wait for the child to finish 119 // wait for the child to finish
95 int status; 120 int status;
96 wait(&status); 121 wait(&status);
122 cnt = WEXITSTATUS(status);
97 } 123 }
98 printf("\n"); 124 printf("\n");
99} 125}