[LTP] [PATCH] kernel/syscalls: add new test with 'open() + O_TMPFILE'
Cyril Hrubis
chrubis@suse.cz
Wed Jan 27 14:22:05 CET 2016
Hi!
> >> +static int dir_not_empty(void)
> >> +{
> >> + struct dirent *entry;
> >> + DIR *dir = SAFE_OPENDIR(cleanup, test_dir);
> >> + int ret = 0;
> >> +
> >> + while ((entry = SAFE_READDIR(cleanup, dir)) != NULL) {
> >> + const char *file = entry->d_name;
> >> +
> >> + if (!strcmp(file, "..") || !strcmp(file, "."))
> >> + continue;
> >> +
> >> + tst_resm(TINFO, "found a file: %s", file);
> >> + ret = 1;
> >> + break;
> >> + }
> >> +
> >> + SAFE_CLOSEDIR(cleanup, dir);
> >> + return ret;
> >> +}
> > Maybe we should add this function to a library, since it's used at two
> > places allready.
>
> OK, tst_dir_is_empty(dir) is fine?
Fine with me.
--
Cyril Hrubis
chrubis@suse.cz
More information about the Ltp
mailing list