From 6971d03520a4ebd3c33f3da6f01438608e3d560d Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sun, 7 Jan 2024 21:24:16 +0000 Subject: [PATCH] preinit: check return from write() --- pkgs/preinit/parseopts.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/preinit/parseopts.c b/pkgs/preinit/parseopts.c index 0523924..868fd52 100644 --- a/pkgs/preinit/parseopts.c +++ b/pkgs/preinit/parseopts.c @@ -36,9 +36,10 @@ char * pr_u32(int32_t input) { i+=2; buf[i] ='\0'; - write(2, buf, i); - - return buf; + if(write(2, buf, i)) + return buf; + else + return NULL; }