1460f32eacf6bfeff222111366ab31b69a815d58 — emersion 10 months ago 41bcddb
builtin: fix ulimit printing
1 files changed, 5 insertions(+), 4 deletions(-)

M builtin/ulimit.c
M builtin/ulimit.c => builtin/ulimit.c +5 -4
@@ 1,13 1,14 @@
 #define _POSIX_C_SOURCE 200809L
+#include <errno.h>
+#include <inttypes.h>
+#include <limits.h>
 #include <mrsh/getopt.h>
 #include <mrsh/shell.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <errno.h>
 #include <string.h>
-#include <limits.h>
-#include <sys/time.h>
 #include <sys/resource.h>
+#include <sys/time.h>
 #include "builtin.h"
 
 static const char ulimit_usage[] = "usage: ulimit [-f] [blocks]\n";


@@ 55,7 56,7 @@ int builtin_ulimit(struct mrsh_state *state, int argc, char *argv[]) {
 		if (old.rlim_max == RLIM_INFINITY) {
 			printf("unlimited\n");
 		} else {
-			printf("%lu\n", old.rlim_max / 512);
+			printf("%" PRIuMAX "\n", (uintmax_t)(old.rlim_max / 512));
 		}
 	} else {
 		fprintf(stderr, "%s", ulimit_usage);