chiark / gitweb /
path-util: Add hidden suffixes for ucf (#3131)
[elogind.git] / src / basic / path-util.c
index 84ff2f387980006f9cc964089bcb24b5206e9873..5f4252f48cfe7d86ece820d592ed21dd336e05bd 100644 (file)
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
 /***
   This file is part of systemd.
 
 ***/
 
 #include <errno.h>
-#include <fcntl.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/statvfs.h>
+#include <sys/stat.h>
 #include <unistd.h>
 
 /* When we include libgen.h because we need dirname() we immediately
 #undef basename
 
 #include "alloc-util.h"
-#include "fd-util.h"
-#include "fileio.h"
+#include "extract-word.h"
 #include "fs-util.h"
 #include "log.h"
 #include "macro.h"
 #include "missing.h"
-#include "parse-util.h"
 #include "path-util.h"
 #include "stat-util.h"
 #include "string-util.h"
 #include "strv.h"
-#include "util.h"
+#include "time-util.h"
 
 bool path_is_absolute(const char *p) {
         return p[0] == '/';
@@ -461,8 +457,6 @@ char* path_join(const char *root, const char *path, const char *rest) {
                                rest && rest[0] == '/' ? rest+1 : rest,
                                NULL);
 }
-#endif // 0
-#if 0 /// UNNEEDED by elogind
 
 int find_binary(const char *name, char **ret) {
         int last_error, r;
@@ -580,10 +574,10 @@ static int binary_is_good(const char *binary) {
         if (r < 0)
                 return r;
 
-        return !path_equal(d, "true") &&
-               !path_equal(d, "/bin/true") &&
-               !path_equal(d, "/usr/bin/true") &&
-               !path_equal(d, "/dev/null");
+        return !PATH_IN_SET(d, "true"
+                               "/bin/true",
+                               "/usr/bin/true",
+                               "/dev/null");
 }
 
 int fsck_exists(const char *fstype) {
@@ -786,6 +780,9 @@ bool hidden_file_allow_backup(const char *filename) {
                 endswith(filename, ".dpkg-bak") ||
                 endswith(filename, ".dpkg-backup") ||
                 endswith(filename, ".dpkg-remove") ||
+                endswith(filename, ".ucf-new") ||
+                endswith(filename, ".ucf-old") ||
+                endswith(filename, ".ucf-dist") ||
                 endswith(filename, ".swp");
 }