Ticket #1675: 0001-sugar-sugar-emulator-refuse-to-run-as-root-1675.patch

File 0001-sugar-sugar-emulator-refuse-to-run-as-root-1675.patch, 1.2 KB (added by sascha_silbe, 14 years ago)

sugar, sugar-emulator: refuse to run as root

  • bin/sugar-emulator

    From 51140065a24329869353f970e37bb4f85110482d Mon Sep 17 00:00:00 2001
    From: Sascha Silbe <sascha@silbe.org>
    Date: Fri, 22 Jan 2010 13:18:16 +0000
    Subject: [PATCH] sugar, sugar-emulator: refuse to run as root (#1675)
    
    It's a very bad idea to run Sugar as root for a variety of reasons, but there
    seem to be people who try it (and fail) nevertheless. Failing early and with a
    clear message increases safety and safes precious developer and user time.
    ---
     bin/sugar-emulator |    5 +++++
     bin/sugar.in       |    5 +++++
     2 files changed, 10 insertions(+), 0 deletions(-)
    
    diff --git a/bin/sugar-emulator b/bin/sugar-emulator
    index 800ca33..308aac7 100755
    a b  
    11#!/bin/sh
    22
     3if [ "$(id -u)" -eq 0 -o "$(id -ru)" -eq 0 ] ; then
     4        echo Refusing to run as root.
     5        exit 3
     6fi
     7
    38# Source debug definitions
    49if [ -f ~/.sugar/debug ]; then
    510        . ~/.sugar/debug
  • bin/sugar.in

    diff --git a/bin/sugar.in b/bin/sugar.in
    index 12768a5..498b573 100644
    a b  
    11#!/bin/sh
    22
     3if [ "$(id -u)" -eq 0 -o "$(id -ru)" -eq 0 ] ; then
     4        echo Refusing to run as root.
     5        exit 3
     6fi
     7
    38usage() {
    49    cat <<EOF
    510Usage: sugar [OPTION]..