Don't try to use acct() on cygwin (which doesn't support it). Fixes: #111

This commit is contained in:
David Given 2018-09-01 10:41:31 +02:00
parent 8d321900b4
commit 5f83fd85dc

View file

@ -47,6 +47,14 @@ struct timeb { /* non-existing; we use an ad-hoc definition */
#include "warn.h" #include "warn.h"
#include "mem.h" #include "mem.h"
/* Detect supported system calls. */
#if !defined __CYGWIN__
#define HAS_ACCT 1
#else
#define HAS_ACCT 0
#endif
#define INPUT 0 #define INPUT 0
#define OUTPUT 1 #define OUTPUT 1
@ -914,6 +922,7 @@ moncall()
case 51: /* Acct */ case 51: /* Acct */
dsp1 = pop_ptr(); dsp1 = pop_ptr();
#if HAS_ACCT
if (!savestr(0, dsp1) || acct(buf[0]) == -1) { if (!savestr(0, dsp1) || acct(buf[0]) == -1) {
push_err(); push_err();
LOG(("@m4 Acct: failed, dsp1 = %lu, errno = %d", LOG(("@m4 Acct: failed, dsp1 = %lu, errno = %d",
@ -923,6 +932,12 @@ moncall()
push_int(0); push_int(0);
LOG(("@m9 Acct: succeeded, dsp1 = %lu", dsp1)); LOG(("@m9 Acct: succeeded, dsp1 = %lu", dsp1));
} }
#else
einval(WMPXIMP);
push_err();
LOG(("@m4 Acct: failed, request = %d, dsp1 = %lu, errno = %d",
request, dsp1, errno));
#endif
break; break;
case 54: /* Ioctl */ case 54: /* Ioctl */