Mercurial > dropbear
comparison scp.c @ 1295:750ec4ec4cbe
Convert #ifdef to #if, other build changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 04 May 2016 15:33:40 +0200 |
parents | 07ee7736397e |
children | 3080aed32bf1 |
comparison
equal
deleted
inserted
replaced
1294:56aba7dedbea | 1295:750ec4ec4cbe |
---|---|
131 fprintf(stderr, "Executing:"); | 131 fprintf(stderr, "Executing:"); |
132 for (i = 0; i < a->num; i++) | 132 for (i = 0; i < a->num; i++) |
133 fprintf(stderr, " %s", a->list[i]); | 133 fprintf(stderr, " %s", a->list[i]); |
134 fprintf(stderr, "\n"); | 134 fprintf(stderr, "\n"); |
135 } | 135 } |
136 #ifdef USE_VFORK | 136 #if DROPBEAR_VFORK |
137 pid = vfork(); | 137 pid = vfork(); |
138 #else | 138 #else |
139 pid = fork(); | 139 pid = fork(); |
140 #endif | 140 #endif |
141 if (pid == -1) | 141 if (pid == -1) |
142 fatal("do_local_cmd: fork: %s", strerror(errno)); | 142 fatal("do_local_cmd: fork: %s", strerror(errno)); |
143 | 143 |
144 if (pid == 0) { | 144 if (pid == 0) { |
145 execvp(a->list[0], a->list); | 145 execvp(a->list[0], a->list); |
146 perror(a->list[0]); | 146 perror(a->list[0]); |
147 #ifdef USE_VFORK | 147 #if DROPBEAR_VFORK |
148 _exit(1); | 148 _exit(1); |
149 #else | 149 #else |
150 exit(1); | 150 exit(1); |
151 #endif | 151 #endif |
152 } | 152 } |
211 close(reserved[0]); | 211 close(reserved[0]); |
212 close(reserved[1]); | 212 close(reserved[1]); |
213 | 213 |
214 /* uClinux needs to build the args here before vforking, | 214 /* uClinux needs to build the args here before vforking, |
215 otherwise we do it later on. */ | 215 otherwise we do it later on. */ |
216 #ifdef USE_VFORK | 216 #if DROPBEAR_VFORK |
217 arg_setup(host, remuser, cmd); | 217 arg_setup(host, remuser, cmd); |
218 #endif | 218 #endif |
219 | 219 |
220 /* Fork a child to execute the command on the remote host using ssh. */ | 220 /* Fork a child to execute the command on the remote host using ssh. */ |
221 #ifdef USE_VFORK | 221 #if DROPBEAR_VFORK |
222 do_cmd_pid = vfork(); | 222 do_cmd_pid = vfork(); |
223 #else | 223 #else |
224 do_cmd_pid = fork(); | 224 do_cmd_pid = fork(); |
225 #endif | 225 #endif |
226 | 226 |
231 dup2(pin[0], 0); | 231 dup2(pin[0], 0); |
232 dup2(pout[1], 1); | 232 dup2(pout[1], 1); |
233 close(pin[0]); | 233 close(pin[0]); |
234 close(pout[1]); | 234 close(pout[1]); |
235 | 235 |
236 #ifndef USE_VFORK | 236 #if !DROPBEAR_VFORK |
237 arg_setup(host, remuser, cmd); | 237 arg_setup(host, remuser, cmd); |
238 #endif | 238 #endif |
239 | 239 |
240 execvp(ssh_program, args.list); | 240 execvp(ssh_program, args.list); |
241 perror(ssh_program); | 241 perror(ssh_program); |
242 #ifdef USE_VFORK | 242 #if DROPBEAR_VFORK |
243 _exit(1); | 243 _exit(1); |
244 #else | 244 #else |
245 exit(1); | 245 exit(1); |
246 #endif | 246 #endif |
247 } else if (do_cmd_pid == -1) { | 247 } else if (do_cmd_pid == -1) { |
248 fatal("fork: %s", strerror(errno)); | 248 fatal("fork: %s", strerror(errno)); |
249 } | 249 } |
250 | 250 |
251 #ifdef USE_VFORK | 251 #if DROPBEAR_VFORK |
252 /* clean up command */ | 252 /* clean up command */ |
253 /* pop cmd */ | 253 /* pop cmd */ |
254 xfree(args.list[args.num-1]); | 254 xfree(args.list[args.num-1]); |
255 args.list[args.num-1]=NULL; | 255 args.list[args.num-1]=NULL; |
256 args.num--; | 256 args.num--; |
302 void source(int, char *[]); | 302 void source(int, char *[]); |
303 void tolocal(int, char *[]); | 303 void tolocal(int, char *[]); |
304 void toremote(char *, int, char *[]); | 304 void toremote(char *, int, char *[]); |
305 void usage(void); | 305 void usage(void); |
306 | 306 |
307 #if defined(DBMULTI_scp) || !defined(DROPBEAR_MULTI) | 307 #if defined(DBMULTI_scp) || !DROPBEAR_MULTI |
308 #if defined(DBMULTI_scp) && defined(DROPBEAR_MULTI) | 308 #if defined(DBMULTI_scp) && DROPBEAR_MULTI |
309 int scp_main(int argc, char **argv) | 309 int scp_main(int argc, char **argv) |
310 #else | 310 #else |
311 int | 311 int |
312 main(int argc, char **argv) | 312 main(int argc, char **argv) |
313 #endif | 313 #endif |