summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-11-16 03:26:01 +0000
committerDamien Miller <djm@mindrot.org>2018-11-16 14:37:33 +1100
commit2a35862e664afde774d4a72497d394fe7306ccb5 (patch)
tree501d6d170178b037829003b76cbd32e23e6080bb /misc.c
parentd0d1dfa55be1c5c0d77ab3096b198a64235f936d (diff)
upstream: use path_absolute() for pathname checks; from Manoj Ampalam
OpenBSD-Commit-ID: 482ce71a5ea5c5f3bc4d00fd719481a6a584d925
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/misc.c b/misc.c
index bdc06fdb3..dd74c8d45 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.c,v 1.133 2018/10/05 14:26:09 naddy Exp $ */ 1/* $OpenBSD: misc.c,v 1.134 2018/11/16 03:26:01 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved. 4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -2037,3 +2037,10 @@ format_absolute_time(uint64_t t, char *buf, size_t len)
2037 localtime_r(&tt, &tm); 2037 localtime_r(&tt, &tm);
2038 strftime(buf, len, "%Y-%m-%dT%H:%M:%S", &tm); 2038 strftime(buf, len, "%Y-%m-%dT%H:%M:%S", &tm);
2039} 2039}
2040
2041/* check if path is absolute */
2042int
2043path_absolute(const char *path)
2044{
2045 return (*path == '/') ? 1 : 0;
2046}