*/
#include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.122 2005/05/24 17:32:43 avsm Exp $");
+RCSID("$OpenBSD: scp.c,v 1.125 2005/07/27 10:39:03 dtucker Exp $");
#include "xmalloc.h"
#include "atomicio.h"
killchild(int signo)
{
if (do_cmd_pid > 1) {
- kill(do_cmd_pid, signo);
+ kill(do_cmd_pid, signo ? signo : SIGTERM);
waitpid(do_cmd_pid, NULL, 0);
}
- _exit(1);
+ if (signo)
+ _exit(1);
+ exit(1);
}
/*
}
typedef struct {
- int cnt;
+ size_t cnt;
char *buf;
} BUF;
BUF *bp;
off_t i, amt, statbytes;
size_t result;
- int fd, haderr, indx;
+ int fd = -1, haderr, indx;
char *last, *name, buf[2048];
int len;
} wrerr;
BUF *bp;
off_t i;
- size_t j;
- int amt, count, exists, first, mask, mode, ofd, omode;
+ size_t j, count;
+ int amt, exists, first, mask, mode, ofd, omode;
off_t size, statbytes;
int setimes, targisdir, wrerrno = 0;
char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];
}
if (targisdir) {
static char *namebuf;
- static int cursize;
+ static size_t cursize;
size_t need;
need = strlen(targ) + strlen(cp) + 250;
errno = ENOTDIR;
}
run_err("%s: %s", cp, strerror(errno));
- exit(1);
+ killchild(0);
}
int