# include <config.h>
#endif
-#include "wrappers.h"
#include "util.h"
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#define ENSC_WRAPPERS_PREFIX "exec-ulimit: "
+#define ENSC_WRAPPERS_UNISTD 1
+#define ENSC_WRAPPERS_FCNTL 1
+#define ENSC_WRAPPERS_RESOURCE 1
+#include <wrappers.h>
#define DECLARE_LIMIT(RES,FNAME) { #FNAME, RLIMIT_##RES }
if (strncmp(buf, "inf", 3)==0) return RLIM_INFINITY;
res = strtol(buf, &errptr, 0);
+ if (errptr!=buf) {
+ switch (*errptr) {
+ case 'M' : res *= 1024; /* fallthrough */
+ case 'K' : res *= 1024; ++errptr; break;
+ case 'm' : res *= 1000; /* fallthrough */
+ case 'k' : res *= 1000; ++errptr; break;
+ default : break;
+ }
+ }
+
if (errptr==buf || (*errptr!='\0' && *errptr!='\n')) {
WRITE_MSG(2, "Invalid limit in '");
WRITE_STR(2, filename);