はてな記法 スーパーpre記法とおぼえがき

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>

int hoge(char* cmd)
{
    int child,status;
    if ((child = fork()) < 0) {
        perror("fork");
        return EXIT_FAILURE;
    }
    if(child == 0){
        execlp("/bin/sh","/bin/sh","-c",cmd,NULL);
        return EXIT_FAILURE;
    } else {
        if(wait(&status) < 0) {
            perror("wait");
            exit(1);
        }
    }
    return status;
}

int main(int argc,char* argv[])
{
    int status;
    int uid;
    uid_t postgres;

    postgres = 26;
    uid = seteuid(postgres);

    printf("postgres user da yo \n");
    printf("getpid() : %d\n", getpid());
    printf("getuid() : %d\n", getuid());
    printf("geteuid() : %d\n", geteuid());
    status = hoge("psql -l");

    printf("%d", status);
    return 0;
}

ファイル属性変えるだけで。。