vtchmod.c 603 Bytes
Newer Older
longpanda's avatar
longpanda committed
1
2
#include <stdio.h>
#include <string.h>
longpanda's avatar
update  
longpanda committed
3
4
#include <sys/types.h>  
#include <sys/stat.h>
longpanda's avatar
longpanda committed
5
#include <sys/utsname.h>
longpanda's avatar
update  
longpanda committed
6
7
8
9
10
11
12

int main(int argc, char **argv)
{
    if (argc != 2)
    {
        return 1;
    }
longpanda's avatar
longpanda committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

    if (argv[1][0] == '-' && argv[1][1] == '6')
    {
        struct utsname buf;
        if (0 == uname(&buf))
        {
            if (strstr(buf.machine, "amd64"))
            {
                return 0;
            }
            
            if (strstr(buf.machine, "x86_64"))
            {
                return 0;
            }
        }
        return 1;
    }

longpanda's avatar
update  
longpanda committed
32
33
34
    return chmod(argv[1], 0777);
}