summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2014-06-26 11:50:34 -0400
committerAllan McRae <allan@archlinux.org>2014-08-03 18:46:32 +1000
commite8de265f8039165dc32ffb78f6a6a5eb0c1514ad (patch)
tree83363a49ca0e14815e2f866d8682a3cb905a4cfe /lib/libalpm
parent0e2db97a42df30d2731e4842b245191a68817d78 (diff)
downloadpacman-e8de265f8039165dc32ffb78f6a6a5eb0c1514ad.tar.xz
move _alpm_lstat into util-common
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/add.c4
-rw-r--r--lib/libalpm/conflict.c2
-rw-r--r--lib/libalpm/diskspace.c2
-rw-r--r--lib/libalpm/remove.c2
-rw-r--r--lib/libalpm/util.c25
-rw-r--r--lib/libalpm/util.h2
6 files changed, 5 insertions, 32 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 4f557a47..bbf2a511 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -209,7 +209,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
* F/N | 3 | 4
* D | 5 | 6
*
- * 1,2- extract, no magic necessary. lstat (_alpm_lstat) will fail here.
+ * 1,2- extract, no magic necessary. lstat (llstat) will fail here.
* 3,4- conflict checks should have caught this. either overwrite
* or backup the file.
* 5- file replacing directory- don't allow it.
@@ -217,7 +217,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
*/
struct stat lsbuf;
- if(_alpm_lstat(filename, &lsbuf) != 0) {
+ if(llstat(filename, &lsbuf) != 0) {
/* cases 1,2: file doesn't exist, skip all backup checks */
} else {
if(S_ISDIR(lsbuf.st_mode)) {
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 2611aefc..961e3a74 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -495,7 +495,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
relative_path = path + rootlen;
/* stat the file - if it exists, do some checks */
- if(_alpm_lstat(path, &lsbuf) != 0) {
+ if(llstat(path, &lsbuf) != 0) {
continue;
}
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index d07b188d..606f2dcc 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -235,7 +235,7 @@ static int calculate_removed_size(alpm_handle_t *handle,
const char *filename = file->name;
snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
- _alpm_lstat(path, &st);
+ llstat(path, &st);
/* skip directories and symlinks to be consistent with libarchive that
* reports them to be zero size */
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 5cbeeb96..dd061e5e 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -457,7 +457,7 @@ static int unlink_file(alpm_handle_t *handle, alpm_pkg_t *oldpkg,
return 1;
}
- if(_alpm_lstat(file, &buf)) {
+ if(llstat(file, &buf)) {
_alpm_log(handle, ALPM_LOG_DEBUG, "file %s does not exist\n", file);
return 1;
}
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index d9f741b3..6dab0de2 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -742,31 +742,6 @@ const char *_alpm_filecache_setup(alpm_handle_t *handle)
return cachedir;
}
-/** lstat wrapper that treats /path/dirsymlink/ the same as /path/dirsymlink.
- * Linux lstat follows POSIX semantics and still performs a dereference on
- * the first, and for uses of lstat in libalpm this is not what we want.
- * @param path path to file to lstat
- * @param buf structure to fill with stat information
- * @return the return code from lstat
- */
-int _alpm_lstat(const char *path, struct stat *buf)
-{
- int ret;
- size_t len = strlen(path);
-
- /* strip the trailing slash if one exists */
- if(len != 0 && path[len - 1] == '/') {
- char *newpath = strdup(path);
- newpath[len - 1] = '\0';
- ret = lstat(newpath, buf);
- free(newpath);
- } else {
- ret = lstat(path, buf);
- }
-
- return ret;
-}
-
#ifdef HAVE_LIBSSL
/** Compute the MD5 message digest of a file.
* @param path file path of file to compute MD5 digest of
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 20f63f64..6f47073b 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -35,7 +35,6 @@
#include <stdarg.h>
#include <stddef.h> /* size_t */
#include <sys/types.h>
-#include <sys/stat.h> /* struct stat */
#include <math.h> /* fabs */
#include <float.h> /* DBL_EPSILON */
#include <fcntl.h> /* open, close */
@@ -128,7 +127,6 @@ int _alpm_ldconfig(alpm_handle_t *handle);
int _alpm_str_cmp(const void *s1, const void *s2);
char *_alpm_filecache_find(alpm_handle_t *handle, const char *filename);
const char *_alpm_filecache_setup(alpm_handle_t *handle);
-int _alpm_lstat(const char *path, struct stat *buf);
int _alpm_test_checksum(const char *filepath, const char *expected, alpm_pkgvalidation_t type);
int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b);
int _alpm_splitname(const char *target, char **name, char **version,