]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib: move fopen_at() to fileutils.h, remove at.h
authorRuediger Meier <ruediger.meier@ga-group.nl>
Mon, 29 Feb 2016 11:49:13 +0000 (12:49 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 7 Mar 2016 14:36:00 +0000 (15:36 +0100)
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
include/Makemodule.am
include/at.h [deleted file]
include/fileutils.h
lib/Makemodule.am
lib/at.c [deleted file]
lib/procutils.c
libmount/src/tab_parse.c

index 0a41a9433a16673e436363d3e8ae4fb38e9bd715..5cdf29a5b70d9a5527e41ed5498e7acc0568446c 100644 (file)
@@ -1,7 +1,6 @@
 
 dist_noinst_HEADERS += \
        include/all-io.h \
-       include/at.h \
        include/bitops.h \
        include/blkdev.h \
        include/canonicalize.h \
diff --git a/include/at.h b/include/at.h
deleted file mode 100644 (file)
index a1c6a8b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * wrappers for "at" functions.
- *
- * Copyright (C) 2010 Karel Zak <kzak@redhat.com>
- *
- * This file may be redistributed under the terms of the
- * GNU Lesser General Public License.
- */
-#ifndef UTIL_LINUX_AT_H
-#define UTIL_LINUX_AT_H
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "c.h"
-
-extern FILE *fopen_at(int dir, const char *filename,
-                       int flags, const char *mode);
-
-#endif /* UTIL_LINUX_AT_H */
index 79dd012377dca538890fc7caeacf3cd4c1857ea5..1cc007c76b99ff8594c2947964a322311c6a84aa 100644 (file)
@@ -28,6 +28,16 @@ static inline FILE *xfmkstemp(char **tmpname, const char *dir, const char *prefi
        return ret;
 }
 
+static inline FILE *fopen_at(int dir, const char *filename,
+                             int flags, const char *mode)
+{
+       int fd = openat(dir, filename, flags);
+       if (fd < 0)
+               return NULL;
+
+       return fdopen(fd, mode);
+}
+
 static inline int is_same_inode(const int fd, const struct stat *st)
 {
        struct stat f;
index 25e1ba04e3b2976bc09d517de2d0e6035905c0ee..81504b9a6ec954fbed8b54b24d7856f58fe8441a 100644 (file)
@@ -2,7 +2,6 @@
 noinst_LTLIBRARIES += libcommon.la
 libcommon_la_CFLAGS = $(AM_CFLAGS)
 libcommon_la_SOURCES = \
-       lib/at.c \
        lib/blkdev.c \
        lib/canonicalize.c \
        lib/crc32.c \
@@ -100,7 +99,7 @@ test_colors_LDADD = $(LDADD) $(TINFO_LIBS)
 test_randutils_SOURCES = lib/randutils.c
 test_randutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM
 
-test_procutils_SOURCES = lib/procutils.c lib/at.c
+test_procutils_SOURCES = lib/procutils.c
 test_procutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM
 
 if LINUX
diff --git a/lib/at.c b/lib/at.c
deleted file mode 100644 (file)
index e32a8f5..0000000
--- a/lib/at.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Portable xxxat() functions.
- *
- * No copyright is claimed.  This code is in the public domain; do with
- * it what you wish.
- *
- * Written by Karel Zak <kzak@redhat.com>
- */
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "at.h"
-#include "c.h"
-
-FILE *fopen_at(int dir, const char *filename, int flags,
-                       const char *mode)
-{
-       int fd = openat(dir, filename, flags);
-
-       if (fd < 0)
-               return NULL;
-
-       return fdopen(fd, mode);
-}
index 6f016345afa419cd51f8a50fe521c3ee178487d7..16d1897b4358e86b9fc94361f9249c12e87baae6 100644 (file)
@@ -24,7 +24,7 @@
 #include <ctype.h>
 
 #include "procutils.h"
-#include "at.h"
+#include "fileutils.h"
 #include "all-io.h"
 #include "c.h"
 
index 9536ebe6bbde511e8bd25b19ecac32e1bdb6fa5f..cee70081691892f97626a22aecdb53171fb412c9 100644 (file)
@@ -17,7 +17,7 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 
-#include "at.h"
+#include "fileutils.h"
 #include "mangle.h"
 #include "mountP.h"
 #include "pathnames.h"