summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e0fda6a)
raw | patch | inline | side by side (parent: e0fda6a)
author | Steffen Prohaska <prohaska@zib.de> | |
Sun, 25 Nov 2007 22:29:03 +0000 (23:29 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 26 Nov 2007 20:32:05 +0000 (12:32 -0800) |
Using the helper function to test for absolute paths makes porting easier.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-lib.c | patch | blob | history | |
lockfile.c | patch | blob | history | |
setup.c | patch | blob | history | |
trace.c | patch | blob | history |
diff --git a/diff-lib.c b/diff-lib.c
index f8e936ae1008fdb7ef8e1722afb839d84c724f6c..d85d8f34ba055ad7e02bf5d61ae4a675ce0be1d3 100644 (file)
--- a/diff-lib.c
+++ b/diff-lib.c
static int is_outside_repo(const char *path, int nongit, const char *prefix)
{
int i;
- if (nongit || !strcmp(path, "-") || path[0] == '/')
+ if (nongit || !strcmp(path, "-") || is_absolute_path(path))
return 1;
if (prefixcmp(path, "../"))
return 0;
diff --git a/lockfile.c b/lockfile.c
index 258fb3f5ef8636e7ff144f551689da3090518a0e..f45d3ed54454635b84cfe9b8c1e7d99d33ffd4d9 100644 (file)
--- a/lockfile.c
+++ b/lockfile.c
return p;
}
- if (link[0] == '/') {
+ if (is_absolute_path(link)) {
/* absolute path simply replaces p */
if (link_len < s)
strcpy(p, link);
index 43cd3f94ea31a7a2a8f8a07cbb67598bb1e52c39..2c7b5cb200414a0fa3f2727c68ea60e51b39c261 100644 (file)
--- a/setup.c
+++ b/setup.c
const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
{
static char path[PATH_MAX];
- if (!pfx || !*pfx || arg[0] == '/')
+ if (!pfx || !*pfx || is_absolute_path(arg))
return arg;
memcpy(path, pfx, pfx_len);
strcpy(path + pfx_len, arg);
index 0d89dbe7794dcdfb8519e6d083f74bf792976c6a..d3d1b6d55e86aab94ddb9712f5eee743b3bfa9a8 100644 (file)
--- a/trace.c
+++ b/trace.c
return STDERR_FILENO;
if (strlen(trace) == 1 && isdigit(*trace))
return atoi(trace);
- if (*trace == '/') {
+ if (is_absolute_path(trace)) {
int fd = open(trace, O_WRONLY | O_APPEND | O_CREAT, 0666);
if (fd == -1) {
fprintf(stderr,