Fixed handling of command output overflow files. - sam - An updated version of the sam text editor.
(HTM) git clone git://vernunftzentrum.de/sam.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit cf544f90a18c4890a958c09a20b2d4b97b22db79
(DIR) parent 29ec8916b4867f462599605a00dc1f04c4619b5b
(HTM) Author: Rob King <jking@deadpixi.com>
Date: Thu, 1 Sep 2016 16:55:57 -0500
Fixed handling of command output overflow files.
Now they match up to the documentation, and also won't crash on very
long path names.
Diffstat:
sam/shell.c | 4 +++-
sam/unix.c | 11 ++++++-----
2 files changed, 9 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/sam/shell.c b/sam/shell.c
@@ -2,9 +2,11 @@
#include "sam.h"
#include "parse.h"
+#include <limits.h>
+
extern jmp_buf mainloop;
-char errfile[64];
+char errfile[PATH_MAX + 1];
String plan9cmd; /* null terminated */
Buffer *plan9buf;
void checkerrs(void);
(DIR) diff --git a/sam/unix.c b/sam/unix.c
@@ -1,8 +1,9 @@
/* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
-#include "sam.h"
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <signal.h>
+#include "sam.h"
+#include <limits.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <signal.h>
#ifdef NEEDVARARG
#include <varargs.h>
@@ -132,7 +133,7 @@ newtmp(void)
void
samerr(char *buf)
{
- sprint(buf, "%s/sam.err.%.6s", TMPDIR, getuser());
+ snprintf(buf, PATH_MAX, "%s/sam.err", getenv("HOME") ? getenv("HOME") : "/tmp", getuser());
}
int