Mercurial > masqmail
comparison src/peopen.c @ 367:b27f66555ba8
Reformated multiline comments to have leading asterisks on each line
Now we use:
/*
** comment
*/
This makes the indent style simpler, too.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Thu, 20 Oct 2011 10:20:59 +0200 |
parents | dcb315792513 |
children | 9bc3e47b0222 |
comparison
equal
deleted
inserted
replaced
366:41958685480d | 367:b27f66555ba8 |
---|---|
1 /* This a snippet I found in sourceforge. I just changed the identing | 1 /* |
2 style to my own and deleted the main function. -- oku | 2 ** This a snippet I found in sourceforge. I just changed the identing |
3 The functions destroy_argv() and create_argv() were added by oku. | 3 ** style to my own and deleted the main function. -- oku |
4 ** The functions destroy_argv() and create_argv() were added by oku. | |
4 */ | 5 */ |
5 | 6 |
6 #include <errno.h> | 7 #include <errno.h> |
7 #include <stdio.h> | 8 #include <stdio.h> |
8 #include <stdlib.h> | 9 #include <stdlib.h> |
53 | 54 |
54 return arr; | 55 return arr; |
55 } | 56 } |
56 | 57 |
57 FILE* | 58 FILE* |
58 peidopen(const char *command, const char *type, char *const envp[], int *ret_pid, uid_t uid, gid_t gid) | 59 peidopen(const char *command, const char *type, char *const envp[], |
60 int *ret_pid, uid_t uid, gid_t gid) | |
59 { | 61 { |
60 enum { Read, Write } mode; | 62 enum { Read, Write } mode; |
61 int pipe_fd[2]; | 63 int pipe_fd[2]; |
62 pid_t pid; | 64 pid_t pid; |
63 | 65 |
91 close(i); | 93 close(i); |
92 } | 94 } |
93 if (close(pipe_fd[mode == Read ? 0 : 1]) != -1 && | 95 if (close(pipe_fd[mode == Read ? 0 : 1]) != -1 && |
94 dup2(pipe_fd[mode == Read ? 1 : 0], | 96 dup2(pipe_fd[mode == Read ? 1 : 0], |
95 mode == Read ? STDOUT_FILENO : STDIN_FILENO) != -1) { | 97 mode == Read ? STDOUT_FILENO : STDIN_FILENO) != -1) { |
96 /* char *argv [] = { "/bin/sh", "-c", (char*) command, NULL }; */ | 98 /* char *argv [] = { "/bin/sh", "-c", (char*) command, NULL }; */ |
97 char **argv = create_argv(command, 10); | 99 char **argv = create_argv(command, 10); |
98 int ret; | 100 int ret; |
99 | 101 |
100 if (uid != (uid_t) - 1) { | 102 if (uid != (uid_t) - 1) { |
101 if ((ret = seteuid(0)) != 0) { | 103 if ((ret = seteuid(0)) != 0) { |