aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-05-23 21:41:59 -0400
committerB. Watson <urchlay@slackware.uk>2026-05-23 21:41:59 -0400
commitb439ab8454467907d27b9cc287d6eb2cb0756a2e (patch)
tree085b11c568fbc9a604efd0b5abab70a387998d74
parent23f1b44654220fbff41b476f2a001a2797d53ba5 (diff)
downloadsbosrcarch-b439ab8454467907d27b9cc287d6eb2cb0756a2e.tar.gz
Do not allow running as root.
-rwxr-xr-xsbosrcarch6
1 files changed, 6 insertions, 0 deletions
diff --git a/sbosrcarch b/sbosrcarch
index b706cf5..b6f053b 100755
--- a/sbosrcarch
+++ b/sbosrcarch
@@ -425,6 +425,11 @@ our $totalfiles = 0;
# check_single_instance() returns.
our $self_fh;
+# 20260523 bkw: as requested by Tadgy:
+sub check_non_root {
+ die "$0 may not be run as root.\n" unless $<;
+}
+
# 20260523 bkw: This may not be portable to non-Linux (or even to
# Perl built on non-Slackware), but it doesn't have to be.
sub check_single_instance {
@@ -1992,6 +1997,7 @@ EOF
$|++;
usage() unless (defined $ARGV[0] && $ARGV[0] !~ /^-+h(?:elp)?/);
+check_non_root();
check_single_instance();
read_config();
for ($ARGV[0]) {