mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
* background.c (do_background): Use pipe() instead of less
portable socketpair(). Close comm[0] in the child.
This commit is contained in:
parent
d999b186f1
commit
ec7f14f929
@ -1,5 +1,8 @@
|
|||||||
2003-10-25 Pavel Roskin <proski@gnu.org>
|
2003-10-25 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* background.c (do_background): Use pipe() instead of less
|
||||||
|
portable socketpair(). Close comm[0] in the child.
|
||||||
|
|
||||||
* wtools.c (mc_message): Fix argument expansion.
|
* wtools.c (mc_message): Fix argument expansion.
|
||||||
|
|
||||||
* background.c: Leave only code used when WITH_BACKGROUND is
|
* background.c: Leave only code used when WITH_BACKGROUND is
|
||||||
|
@ -41,11 +41,6 @@
|
|||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "wtools.h"
|
#include "wtools.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* We currenlty only support one way of comunicating the background
|
|
||||||
* and foreground process by using the socketpair system call
|
|
||||||
*/
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include "fileopctx.h"
|
#include "fileopctx.h"
|
||||||
#include "key.h" /* For add_select_channel(), delete_select_channel() */
|
#include "key.h" /* For add_select_channel(), delete_select_channel() */
|
||||||
#include "eregex.h"
|
#include "eregex.h"
|
||||||
@ -55,10 +50,6 @@
|
|||||||
/* If true, this is a background process */
|
/* If true, this is a background process */
|
||||||
int we_are_background = 0;
|
int we_are_background = 0;
|
||||||
|
|
||||||
#ifndef HAVE_SOCKETPAIR
|
|
||||||
int socketpair(int, int, int, int fd[2]);
|
|
||||||
#endif /* HAVE_SOCKETPAIR */
|
|
||||||
|
|
||||||
/* File descriptor for talking to our parent */
|
/* File descriptor for talking to our parent */
|
||||||
static int parent_fd;
|
static int parent_fd;
|
||||||
|
|
||||||
@ -120,7 +111,7 @@ do_background (struct FileOpContext *ctx, char *info)
|
|||||||
int comm[2]; /* control connection stream */
|
int comm[2]; /* control connection stream */
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
if (socketpair (AF_UNIX, SOCK_STREAM, 0, comm) == -1)
|
if (pipe (comm) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ((pid = fork ()) == -1)
|
if ((pid = fork ()) == -1)
|
||||||
@ -129,6 +120,7 @@ do_background (struct FileOpContext *ctx, char *info)
|
|||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
int nullfd;
|
int nullfd;
|
||||||
|
|
||||||
|
close (comm[0]);
|
||||||
parent_fd = comm[1];
|
parent_fd = comm[1];
|
||||||
we_are_background = 1;
|
we_are_background = 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user