diff options
| author | Andreas Schwab | 2010-07-01 01:07:11 +0200 |
|---|---|---|
| committer | Andreas Schwab | 2010-07-01 01:07:11 +0200 |
| commit | ce8f5a9a47d15ff76f33648d2b016fe819d2493f (patch) | |
| tree | 4197b4dc3e93e50648407e32a113878f0d4105e9 /src | |
| parent | 2b7e356a10591abd4d69b1bd5fad0f3746c9ab79 (diff) | |
| download | emacs-ce8f5a9a47d15ff76f33648d2b016fe819d2493f.tar.gz emacs-ce8f5a9a47d15ff76f33648d2b016fe819d2493f.zip | |
Avoid erroneous syscalls
* process.c (create_process): Avoid using invalid file descriptors.
* callproc.c (child_setup): Avoid closing a file descriptor twice.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/callproc.c | 6 | ||||
| -rw-r--r-- | src/process.c | 9 |
3 files changed, 16 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c86c285e091..0d17a8f21fb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-06-30 Andreas Schwab <schwab@linux-m68k.org> | ||
| 2 | |||
| 3 | * process.c (create_process): Avoid using invalid file descriptors. | ||
| 4 | |||
| 5 | * callproc.c (child_setup): Avoid closing a file descriptor twice. | ||
| 6 | |||
| 1 | 2010-06-30 Jan Djärv <jan.h.d@swipnet.se> | 7 | 2010-06-30 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 8 | ||
| 3 | * xsettings.c (Ffont_get_system_normal_font, Ffont_get_system_font): | 9 | * xsettings.c (Ffont_get_system_normal_font, Ffont_get_system_font): |
diff --git a/src/callproc.c b/src/callproc.c index 82a5ebb90da..cd06ad5c2e8 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -1244,8 +1244,10 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) | |||
| 1244 | dup2 (out, 1); | 1244 | dup2 (out, 1); |
| 1245 | dup2 (err, 2); | 1245 | dup2 (err, 2); |
| 1246 | emacs_close (in); | 1246 | emacs_close (in); |
| 1247 | emacs_close (out); | 1247 | if (out != in) |
| 1248 | emacs_close (err); | 1248 | emacs_close (out); |
| 1249 | if (err != in && err != out) | ||
| 1250 | emacs_close (err); | ||
| 1249 | #endif /* not MSDOS */ | 1251 | #endif /* not MSDOS */ |
| 1250 | #endif /* not WINDOWSNT */ | 1252 | #endif /* not WINDOWSNT */ |
| 1251 | 1253 | ||
diff --git a/src/process.c b/src/process.c index 22b85ff5910..24f31220d0d 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2038,7 +2038,7 @@ create_process (process, new_argv, current_dir) | |||
| 2038 | process_set_signal to fail on SGI when using a pipe. */ | 2038 | process_set_signal to fail on SGI when using a pipe. */ |
| 2039 | setsid (); | 2039 | setsid (); |
| 2040 | /* Make the pty's terminal the controlling terminal. */ | 2040 | /* Make the pty's terminal the controlling terminal. */ |
| 2041 | if (pty_flag) | 2041 | if (pty_flag && xforkin >= 0) |
| 2042 | { | 2042 | { |
| 2043 | #ifdef TIOCSCTTY | 2043 | #ifdef TIOCSCTTY |
| 2044 | /* We ignore the return value | 2044 | /* We ignore the return value |
| @@ -2081,8 +2081,11 @@ create_process (process, new_argv, current_dir) | |||
| 2081 | /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here? | 2081 | /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here? |
| 2082 | I can't test it since I don't have 4.3. */ | 2082 | I can't test it since I don't have 4.3. */ |
| 2083 | int j = emacs_open ("/dev/tty", O_RDWR, 0); | 2083 | int j = emacs_open ("/dev/tty", O_RDWR, 0); |
| 2084 | ioctl (j, TIOCNOTTY, 0); | 2084 | if (j >= 0) |
| 2085 | emacs_close (j); | 2085 | { |
| 2086 | ioctl (j, TIOCNOTTY, 0); | ||
| 2087 | emacs_close (j); | ||
| 2088 | } | ||
| 2086 | #ifndef USG | 2089 | #ifndef USG |
| 2087 | /* In order to get a controlling terminal on some versions | 2090 | /* In order to get a controlling terminal on some versions |
| 2088 | of BSD, it is necessary to put the process in pgrp 0 | 2091 | of BSD, it is necessary to put the process in pgrp 0 |