continue;
}
- lstat(argv[i], &st);
- if ((st.st_mode & S_IFMT) == S_IFLNK) {
+ if (is_symlink(argv[i])) {
/* Don't rewrite source file path if it's a symlink since
make_relative_path resolves symlinks using realpath(3) and this leads
to potentially choosing incorrect relative header files. See the
char *get_relative_path(const char *from, const char *to);
bool is_absolute_path(const char *path);
bool is_full_path(const char *path);
+bool is_symlink(const char *path);
void update_mtime(const char *path);
void x_exit(int status) ATTR_NORETURN;
int x_rename(const char *oldpath, const char *newpath);
/*
- * Copyright (C) 2010 Joel Rosdahl
+ * Copyright (C) 2010-2016 Joel Rosdahl
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
return lstat(path, &st) == 0;
}
-bool
-is_symlink(const char *path)
-{
-#ifdef _WIN32
- (void) path;
- return 0;
-#else
- struct stat st;
- return lstat(path, &st) == 0 && S_ISLNK(st.st_mode);
-#endif
-}
-
void
create_file(const char *path, const char *content)
{
return false;
}
+bool is_symlink(const char *path)
+{
+#ifdef _WIN32
+ (void)path;
+ return false;
+#else
+ struct stat st;
+ return x_lstat(path, &st) == 0 && ((st.st_mode & S_IFMT) == S_IFLNK);
+#endif
+}
+
/*
* Update the modification time of a file in the cache to save it from LRU
* cleanup.