Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/selinux/runcon.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 983 by niro, Fri Apr 24 18:33:46 2009 UTC revision 984 by niro, Sun May 30 11:32:42 2010 UTC
# Line 25  Line 25 
25   *   *
26   * Port to busybox: KaiGai Kohei <kaigai@kaigai.gr.jp>   * Port to busybox: KaiGai Kohei <kaigai@kaigai.gr.jp>
27   *                  - based on coreutils-5.97 (in Fedora Core 6)   *                  - based on coreutils-5.97 (in Fedora Core 6)
28     *
29     * Licensed under GPLv2, see file LICENSE in this tarball for details.
30   */   */
31  #include <getopt.h>  #include <getopt.h>
32  #include <selinux/context.h>  #include <selinux/context.h>
# Line 39  static context_t runcon_compute_new_cont Line 41  static context_t runcon_compute_new_cont
41   security_context_t cur_context;   security_context_t cur_context;
42    
43   if (getcon(&cur_context))   if (getcon(&cur_context))
44   bb_error_msg_and_die("cannot get current context");   bb_error_msg_and_die("can't get current context");
45    
46   if (compute_trans) {   if (compute_trans) {
47   security_context_t file_context, new_context;   security_context_t file_context, new_context;
48    
49   if (getfilecon(command, &file_context) < 0)   if (getfilecon(command, &file_context) < 0)
50   bb_error_msg_and_die("cannot retrieve attributes of '%s'",   bb_error_msg_and_die("can't retrieve attributes of '%s'",
51       command);       command);
52   if (security_compute_create(cur_context, file_context,   if (security_compute_create(cur_context, file_context,
53      SECCLASS_PROCESS, &new_context))      SECCLASS_PROCESS, &new_context))
# Line 127  int runcon_main(int argc UNUSED_PARAM, c Line 129  int runcon_main(int argc UNUSED_PARAM, c
129       context_str(con));       context_str(con));
130    
131   if (setexeccon(context_str(con)))   if (setexeccon(context_str(con)))
132   bb_error_msg_and_die("cannot set up security context '%s'",   bb_error_msg_and_die("can't set up security context '%s'",
133       context_str(con));       context_str(con));
134    
135   execvp(argv[0], argv);   execvp(argv[0], argv);
136    
137   bb_perror_msg_and_die("cannot execute '%s'", argv[0]);   bb_perror_msg_and_die("can't execute '%s'", argv[0]);
138  }  }

Legend:
Removed from v.983  
changed lines
  Added in v.984