~siretart/cryptsetup/debian

« back to all changes in this revision

Viewing changes to debian/patches/03_check_for_root.patch

  • 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
## 03_check_for_root.patch
 
2
## by Jonas Meurer <mejo@debian.org>
 
3
##
 
4
## check for UID == 0 before actually doing anything.
 
5
 
 
6
--- a/src/cryptsetup.c
 
7
+++ b/src/cryptsetup.c
 
8
@@ -6,6 +6,8 @@
 
9
 #include <errno.h>
 
10
 #include <unistd.h>
 
11
 #include <assert.h>
 
12
+#include <unistd.h>
 
13
+#include <sys/types.h>
 
14
 
 
15
 #include <libcryptsetup.h>
 
16
 #include <popt.h>
 
17
@@ -431,6 +433,10 @@
 
18
 
 
19
 int main(int argc, char **argv)
 
20
 {
 
21
+       if (geteuid() != 0) {
 
22
+               fprintf(stderr, _("You have to be root to use cryptsetup!\n"));
 
23
+               return EXIT_FAILURE;
 
24
+       }
 
25
        static char *popt_tmp;
 
26
        static struct poptOption popt_help_options[] = {
 
27
                { NULL,    '\0', POPT_ARG_CALLBACK, help, 0, NULL,                         NULL },