Browse Source

调整代码格式

master
453530270@qq.com 2 years ago
parent
commit
9166a7a159
  1. 4
      client.c

4
client.c

@ -132,6 +132,7 @@ int rcopy_client(char *src, char *host, unsigned short port, char *r_src, int ty
exit(1);
}
// 发送文件
if (r.type == TRANSFILE) {
FILE *out;
if ((out = fopen(src, "rb")) != NULL) {
@ -147,6 +148,7 @@ int rcopy_client(char *src, char *host, unsigned short port, char *r_src, int ty
}
}
// 读取socket数据
int status, len;
len = read(sockfd, &status, sizeof(int));
if (len != sizeof(int)) {
@ -154,6 +156,7 @@ int rcopy_client(char *src, char *host, unsigned short port, char *r_src, int ty
exit(1);
} else {
if (status == SENDFILE) {
// 获取pid
pid_t pid = fork();
if (pid == 0) {
close(sockfd); // child will initate a new connection.
@ -207,6 +210,7 @@ int rcopy_client(char *src, char *host, unsigned short port, char *r_src, int ty
while (fcalls > 0) {
wait(&status);
if (WIFEXITED(status)) {
// 从子进程的终止状态中提取出退出状态码
pid = WEXITSTATUS(status);
if (!final) {
final = pid;

Loading…
Cancel
Save