/[projects]/misc/update-wrapper/update.c
ViewVC logotype

Contents of /misc/update-wrapper/update.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 330 - (show annotations) (download)
Thu Sep 17 09:39:30 2009 UTC (14 years, 8 months ago) by torben
File MIME type: text/plain
File size: 540 byte(s)
Added some more old code

1 #include <stdlib.h>
2 #include <unistd.h>
3 #include <stdio.h>
4
5 void error(const char* str)
6 {
7 printf("could not %s\n", str);
8 exit(1);
9 }
10
11 int main(int argc, char *argv[] )
12 {
13 if (setuid(0) == -1) {
14 error( "setuid(0)" );
15 }
16 if (seteuid(0) == -1) {
17 error( "seteuid(0)" );
18 }
19
20 if (setgid(0) == -1) {
21 error( "setgid(0)" );
22 }
23 if (setegid(0) == -1) {
24 error( "setegid(0)" );
25 }
26 if (setenv("PATH", "/sbin:/usr/sbin:/bin:/usr/bin",1) == -1) {
27 error("setenv");
28 }
29 system( "apt-get update" );
30 system( "apt-get upgrade" );
31
32 return 0;
33 }

  ViewVC Help
Powered by ViewVC 1.1.20