#include "loopdev.h"
#include "closestream.h"
#include "optutils.h"
+#include "fileutils.h"
/* this is the default upper limit, could be modified by --nr */
#define SLICES_MAX 256
while ((d = readdir(dir))) {
int fd;
- if (!strcmp(d->d_name, ".") ||
- !strcmp(d->d_name, ".."))
+ if (is_dotdir_dirent(d))
continue;
#ifdef _DIRENT_HAVE_D_TYPE
if (d->d_type != DT_DIR && d->d_type != DT_UNKNOWN)
d->d_type != DT_LNK)
continue;
#endif
- if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
+ if (is_dotdir_dirent(d))
continue;
if (hasprefix) {
DBG(ITER, ul_debugobj(iter, "check %s", d->d_name));
- if (strcmp(d->d_name, ".") == 0
- || strcmp(d->d_name, "..") == 0
- || strncmp(d->d_name, "loop", 4) != 0)
+ if (is_dotdir_dirent(d) || strncmp(d->d_name, "loop", 4) != 0)
continue;
snprintf(name, sizeof(name), "%s/loop/backing_file", d->d_name);
#include "c.h"
#include "nls.h"
#include "strutils.h"
+#include "fileutils.h"
#include "libsmartcols.h"
while ((d = readdir(dir))) {
struct stat st;
- if (strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0)
+ if (is_dotdir_dirent(d))
continue;
if (fstatat(fd, d->d_name, &st, AT_SYMLINK_NOFOLLOW) != 0)
continue;
#include "c.h"
#include "closestream.h"
#include "canonicalize.h"
+#include "fileutils.h"
#include "debug.h"
dir, buf, postfix ? postfix : ""));
while ((dp = readdir(dirp)) != NULL) {
- if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
+ if (is_dotdir_dirent(dp))
continue;
if (postfix)
snprintf(d, PATH_MAX - len, "%s%s", dp->d_name, postfix);
#include "pathnames.h"
#include "sysfs.h"
#include "monotonic.h"
+#include "fileutils.h"
/*
* sg_io_hdr_t driver_status -- see kernel include/scsi/sg.h
/* scan for partition subdirs */
while ((d = readdir(dir))) {
- if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
+ if (is_dotdir_dirent(d))
continue;
if (sysfs_blkdev_is_partition_dirent(dir, d, ctl->device)) {
#include "nls.h"
#include "closestream.h"
#include "statfs_magic.h"
+#include "fileutils.h"
#ifndef MS_MOVE
#define MS_MOVE 8192
break; /* end of directory */
}
- if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
+ if (is_dotdir_dirent(d))
continue;
#ifdef _DIRENT_HAVE_D_TYPE
if (d->d_type == DT_DIR || d->d_type == DT_UNKNOWN)