The error indicates that the test is failing because it cannot create the directory /test/growfiles/reiser.
PATCH 1/1 The error indicates that the test is failing because it cannot create the directory /test/growfiles/reiser.
From: lekshmi-cpillai <[email protected]>
Signed-off-by lekshmi-cpillai <[email protected]>
--- testcases/kernel/fs/doio/growfiles.c | 35 +++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
testcases/kernel/fs/doio/growfiles.c +34 -1
@@ -119,6 +119,38 @@ int lkfile(int fd, int operation, int lklevel);int pre_alloc (int fd,long size);#endif /* !linux */ +/* Helper function to create directories recursively */ +static int mkdir_recursive (const char *path,mode_t mode) +{ +char tmp[PATH_MAX ]; +char *p =NULL ; +size_t len; +struct stat st; + +snprintf (tmp,sizeof (tmp),"%s" , path); + len =strlen (tmp); +if (tmp[len -1 ] =='/' ) + tmp[len -1 ] =0 ; + +for (p = tmp +1 ; *p; p++) { +if (*p =='/' ) { + *p =0 ; +if (stat (tmp, &st) ==-1 ) { +if (mkdir (tmp, mode) ==-1 && errno !=EEXIST ) { +return -1 ; + } + } + *p ='/' ; + } + } +if (stat (tmp, &st) ==-1 ) { +if (mkdir (tmp, mode) ==-1 && errno !=EEXIST ) { +return -1 ; + } + } +return 0 ; +} +extern int datapidgen (int ,char *,int ,int );extern int datapidchk (int ,char *,int ,int ,char **);
@@ -482,7 +514,7 @@ int main(int argc, char **argv)unsetenv ("TMPDIR" );/* force the use of auto_dir */ #endif if (stat (auto_dir, &statbuf) ==-1 ) { -if (mkdir (auto_dir,0777 ) ==-1 ) { +if (mkdir_recursive (auto_dir,0777 ) ==-1 ) {if (errno !=EEXIST ) { fprintf(stderr, "%s%s: Unable to make dir %s\n",
@@ -3058,3 +3090,4 @@ int pre_alloc(int fd, long size) return 0; }#endif +
Signature · 5 lines
2.39.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp