--- trace.c 2001/08/14 08:15:26 1.1
+++ trace.c 2001/08/20 11:28:30 1.2
@@ -1,6 +1,19 @@
+#include <errno.h>
+#include <limits.h>
+
#include "trace.h"
+#ifndef _POSIX_PATH_MAX
+#if defined(PATH_MAX)
+#define _POSIX_PATH_MAX PATH_MAX
+#elif defined(MAX_PATH)
+#define _POSIX_PATH_MAX MAX_PATH
+#else
+#error "unable to determime maximum path limit"
+#endif
+#endif
+
/*
* tracing
*/
@@ -9,10 +22,10 @@
{
ssize_t rc;
int tf;
- static char tfn[PATH_MAX] = "/tmp/trace";
+ static char tfn[_POSIX_PATH_MAX] = "/tmp/trace";
if ((d == -1) && (buf != NULL) && (nbytes == 0)) {
- strncpy(tfn, buf, PATH_MAX-1);
+ strncpy(tfn, buf, _POSIX_PATH_MAX-1);
}
rc = read(d, buf, nbytes);
if ((tf = open(tfn, O_CREAT|O_WRONLY|O_APPEND, 0664)) != -1) {
@@ -26,10 +39,10 @@
{
ssize_t rc;
int tf;
- static char tfn[PATH_MAX] = "/tmp/trace";
+ static char tfn[_POSIX_PATH_MAX] = "/tmp/trace";
if ((d == -1) && (buf != NULL) && (nbytes == 0)) {
- strncpy(tfn, buf, PATH_MAX-1);
+ strncpy(tfn, buf, _POSIX_PATH_MAX-1);
}
rc = write(d, buf, nbytes);
|