From e6b5c30a4e03696d9cc76b38a3dfc53f753f44a5 Mon Sep 17 00:00:00 2001 From: Eirik Nygaard Date: Sat, 5 Jun 2004 10:02:07 +0000 Subject: [PATCH] Print the entire path to where the checkpoint file is being created to avoid confusion if the application changes it's working dir. Pointers by: Matthew Dillon --- sys/checkpt/support.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/checkpt/support.c b/sys/checkpt/support.c index b9f7b39e67..5f1ddfbfbe 100644 --- a/sys/checkpt/support.c +++ b/sys/checkpt/support.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/checkpt/Attic/support.c,v 1.1 2003/10/20 04:48:42 dillon Exp $ + * $DragonFly: src/sys/checkpt/Attic/support.c,v 1.2 2004/06/05 10:02:07 eirikn Exp $ */ /* prune the includes XXX */ @@ -63,6 +63,7 @@ #include #include #include +#include #include "checkpt.h" @@ -97,7 +98,17 @@ ckpt_expand_name(const char *name, uid_t uid, pid_t pid) if (temp == NULL) return NULL; namelen = strlen(name); - for (i = 0, n = 0; n < MAXPATHLEN && format[i]; i++) { + n = 0; + if (ckptfilename[0] != '/') { + if (kern_getcwd(temp, MAXPATHLEN - 1) != 0) { + free(temp, M_TEMP); + return NULL; + } + n = strlen(temp); + temp[n++] = '/'; + temp[n] = '\0'; + } + for (i= 0; n < MAXPATHLEN && format[i]; i++) { int l; switch (format[i]) { case '%': /* Format character */ -- 2.41.0