~siretart/cryptsetup/debian

« back to all changes in this revision

Viewing changes to debian/patches/03_check_for_root.dpatch

  • Committer: Reinhard Tartler
  • Date: 2008-06-13 19:34:53 UTC
  • Revision ID: siretart@tauware.de-20080613193453-ywl35m67ce8pzvp3
import cryptsetup_1.0.6-1.dsc

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
 
3
 
## 03_check_for_root.dpatch
4
 
## by Jonas Meurer <mejo@debian.org>
5
 
##
6
 
## All lines beginning with `## DP:' are a description of the patch.
7
 
## DP: check for UID == 0 before actually doing anything.
8
 
 
9
 
@DPATCH@
10
 
diff -urNad cryptsetup-1.0.6~pre1~/src/cryptsetup.c cryptsetup-1.0.6~pre1/src/cryptsetup.c
11
 
--- cryptsetup-1.0.6~pre1~/src/cryptsetup.c     2007-12-01 17:46:10.000000000 +0100
12
 
+++ cryptsetup-1.0.6~pre1/src/cryptsetup.c      2007-12-04 13:25:23.000000000 +0100
13
 
@@ -6,6 +6,8 @@
14
 
 #include <errno.h>
15
 
 #include <unistd.h>
16
 
 #include <assert.h>
17
 
+#include <unistd.h>
18
 
+#include <sys/types.h>
19
 
 
20
 
 #include <libcryptsetup.h>
21
 
 #include <popt.h>
22
 
@@ -424,6 +426,10 @@
23
 
 
24
 
 int main(int argc, char **argv)
25
 
 {
26
 
+       if (geteuid() != 0) {
27
 
+               fprintf(stderr, _("You have to be root to use cryptsetup!\n"));
28
 
+               return EXIT_FAILURE;
29
 
+       }
30
 
        static char *popt_tmp;
31
 
        static struct poptOption popt_help_options[] = {
32
 
                { NULL,    '\0', POPT_ARG_CALLBACK, help, 0, NULL,                         NULL },