From 8fcbe777412b301e5dddd4931b2e1016802141b8 Mon Sep 17 00:00:00 2001
From: Ron Yorston <rmy@pobox.com>
Date: Sat, 9 Mar 2019 11:02:31 +0000
Subject: win32: add a function to detect running with elevated privileges

Add is_admin() and use it to alter the command prompt in the line
editor when running with admin privileges.
---
 libbb/lineedit.c | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'libbb')

diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 95f92aa75..9e24d410d 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -45,6 +45,9 @@
 # define _POSIX_VDISABLE '\0'
 #endif
 
+#if ENABLE_PLATFORM_MINGW32
+# define geteuid() (is_admin() ? 0 : DEFAULT_UID)
+#endif
 
 #ifdef TEST
 # define ENABLE_FEATURE_EDITING 0
-- 
cgit v1.2.3-55-g6feb