diff options
| author | Kenichi Handa | 2012-10-13 22:11:40 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-10-13 22:11:40 +0900 |
| commit | 2e58893d168a90c475d4b5ba738b19113f6494ea (patch) | |
| tree | 0688fdb217a0cf7f6ad1ca212c4ddb508d845301 | |
| parent | 0ba06a77fd4ccf92f1106b8ab7d8d64d6d812a1d (diff) | |
| parent | 076a4db2fe51a9a1d3a379955499a12059c50d45 (diff) | |
| download | emacs-2e58893d168a90c475d4b5ba738b19113f6494ea.tar.gz emacs-2e58893d168a90c475d4b5ba738b19113f6494ea.zip | |
merge trunk
| -rw-r--r-- | doc/emacs/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/emacs/files.texi | 25 | ||||
| -rw-r--r-- | doc/lispref/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 62 | ||||
| -rw-r--r-- | etc/NEWS | 6 | ||||
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/emacs-lisp/debug.el | 26 | ||||
| -rw-r--r-- | lisp/textmodes/ispell.el | 13 | ||||
| -rw-r--r-- | lisp/url/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/url/url-file.el | 3 | ||||
| -rw-r--r-- | lisp/url/url-http.el | 8 | ||||
| -rw-r--r-- | lisp/url/url-vars.el | 3 | ||||
| -rw-r--r-- | lisp/url/url.el | 12 | ||||
| -rw-r--r-- | src/ChangeLog | 17 | ||||
| -rw-r--r-- | src/fileio.c | 71 | ||||
| -rw-r--r-- | src/image.c | 44 | ||||
| -rw-r--r-- | src/process.c | 17 |
17 files changed, 165 insertions, 171 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 3aad65f7bed..47a4c8da522 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-10-13 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * files.texi (File Conveniences): ImageMagick enabled by default. | ||
| 4 | |||
| 1 | 2012-10-10 Dani Moncayo <dmoncayo@gmail.com> | 5 | 2012-10-10 Dani Moncayo <dmoncayo@gmail.com> |
| 2 | 6 | ||
| 3 | * basic.texi (Arguments): Fix typos. | 7 | * basic.texi (Arguments): Fix typos. |
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index c1cebc424ca..e12bb385653 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi | |||
| @@ -1931,15 +1931,22 @@ non-@code{nil}. Currently, Emacs only supports animation in GIF | |||
| 1931 | files. | 1931 | files. |
| 1932 | 1932 | ||
| 1933 | @cindex ImageMagick support | 1933 | @cindex ImageMagick support |
| 1934 | If your Emacs was compiled with ImageMagick support, it is possible | 1934 | @vindex imagemagick-enabled-types |
| 1935 | to view a much wider variety of image types in Image mode, by | 1935 | @vindex imagemagick-types-inhibit |
| 1936 | rendering the images via ImageMagick. However, this feature is | 1936 | If Emacs was compiled with support for the ImageMagick library, it |
| 1937 | currently disabled by default. To enable it, add the following line | 1937 | can use ImageMagick to render a wide variety of images. The variable |
| 1938 | to your init file: | 1938 | @code{imagemagick-enabled-types} lists the image types that Emacs may |
| 1939 | 1939 | render using ImageMagick; each element in the list should be an | |
| 1940 | @example | 1940 | internal ImageMagick name for an image type, as a symbol or an |
| 1941 | (imagemagick-register-types) | 1941 | equivalent string (e.g.@: @code{BMP} for @file{.bmp} images). To |
| 1942 | @end example | 1942 | enable ImageMagick for all possible image types, change |
| 1943 | @code{imagemagick-enabled-types} to @code{t}. The variable | ||
| 1944 | @code{imagemagick-types-inhibit} lists the image types which should | ||
| 1945 | never be rendered using ImageMagick, regardless of the value of | ||
| 1946 | @code{imagemagick-enabled-types} (the default list includes types like | ||
| 1947 | @code{C} and @code{HTML}, which ImageMagick can render as an ``image'' | ||
| 1948 | but Emacs should not). To disable ImageMagick entirely, change | ||
| 1949 | @code{imagemagick-types-inhibit} to @code{t}. | ||
| 1943 | 1950 | ||
| 1944 | @findex thumbs-mode | 1951 | @findex thumbs-mode |
| 1945 | @findex mode, thumbs | 1952 | @findex mode, thumbs |
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 974a0d67192..40c457ffe07 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-10-13 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * display.texi (ImageMagick Images): ImageMagick enabled by default. | ||
| 4 | |||
| 1 | 2012-10-05 Chong Yidong <cyd@gnu.org> | 5 | 2012-10-05 Chong Yidong <cyd@gnu.org> |
| 2 | 6 | ||
| 3 | * minibuf.texi (Basic Completion): Clarify list form of completion | 7 | * minibuf.texi (Basic Completion): Clarify list form of completion |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 11a86f3c1c5..3f92c50e2bc 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -4579,57 +4579,35 @@ specifying the bounding box of the PostScript image, analogous to the | |||
| 4579 | @cindex images, support for more formats | 4579 | @cindex images, support for more formats |
| 4580 | 4580 | ||
| 4581 | If you build Emacs with ImageMagick support, you can use the | 4581 | If you build Emacs with ImageMagick support, you can use the |
| 4582 | ImageMagick library to load many image formats. The image type symbol | 4582 | ImageMagick library to load many image formats (@pxref{File |
| 4583 | Conveniences,,, emacs, The GNU Emacs Manual}). The image type symbol | ||
| 4583 | for images loaded via ImageMagick is @code{imagemagick}, regardless of | 4584 | for images loaded via ImageMagick is @code{imagemagick}, regardless of |
| 4584 | the actual underlying image format. | 4585 | the actual underlying image format. |
| 4585 | 4586 | ||
| 4586 | @defun imagemagick-types | 4587 | @defun imagemagick-types |
| 4587 | This function returns a list of image file extensions supported by the | 4588 | This function returns a list of image file extensions supported by the |
| 4588 | current ImageMagick installation. | 4589 | current ImageMagick installation. Each list element is a symbol |
| 4589 | @end defun | 4590 | representing an internal ImageMagick name for an image type, such as |
| 4590 | 4591 | @code{BMP} for @file{.bmp} images. | |
| 4591 | By default, Emacs does not use ImageMagick to display images in | 4592 | @end defun |
| 4592 | Image mode, e.g.@: when visiting such files with @kbd{C-x C-f}. This | 4593 | |
| 4593 | feature is enabled by calling @code{imagemagick-register-types}. | 4594 | @defopt imagemagick-enabled-types |
| 4594 | 4595 | The value of this variable is a list of ImageMagick image types which | |
| 4595 | @defun imagemagick-register-types | 4596 | Emacs may attempt to render using ImageMagick. Each list element |
| 4596 | This function enables using Image mode to visit image files supported | 4597 | should be one of the symbols in the list returned by |
| 4597 | by ImageMagick. @xref{File Conveniences,,, emacs, The GNU Emacs | 4598 | @code{imagemagick-types}, or an equivalent string. Alternatively, a |
| 4598 | Manual}. It also causes @code{create-image} and other helper | 4599 | value of @code{t} enables ImageMagick for all possible image types. |
| 4599 | functions to associate such file names with the @code{imagemagick} | 4600 | Regardless of the value of this variable, |
| 4600 | image type (@pxref{Defining Images}). | 4601 | @code{imagemagick-types-inhibit} (see below) takes precedence. |
| 4601 | 4602 | @end defopt | |
| 4602 | All image file extensions supported by ImageMagick are registered, | ||
| 4603 | except those specified in @code{imagemagick-types-inhibit}. If Emacs | ||
| 4604 | was not compiled with ImageMagick support, this function does nothing. | ||
| 4605 | @end defun | ||
| 4606 | 4603 | ||
| 4607 | @defopt imagemagick-types-inhibit | 4604 | @defopt imagemagick-types-inhibit |
| 4608 | This variable specifies a list of image types that should @emph{not} | 4605 | The value of this variable lists the ImageMagick image types which |
| 4609 | be registered by @code{imagemagick-register-types}. Each entry in | 4606 | should never be rendered using ImageMagick, regardless of the value of |
| 4610 | this list should be one of the symbols returned by | 4607 | @code{imagemagick-enabled-types}. A value of @code{t} disables |
| 4611 | @code{imagemagick-types}. The default value lists several file types | 4608 | ImageMagick entirely. |
| 4612 | that are considered ``images'' by ImageMagick, but which should not be | ||
| 4613 | considered as images by Emacs, including C files and HTML files. | ||
| 4614 | @end defopt | 4609 | @end defopt |
| 4615 | 4610 | ||
| 4616 | @ignore | ||
| 4617 | @c I don't know what this means. I suspect it means eg loading jpg | ||
| 4618 | @c images via libjpeg or ImageMagick. But it doesn't work. | ||
| 4619 | @c If you don't have libjpeg support compiled in, you cannot | ||
| 4620 | @c view jpeg images, even if you have imagemagick support: | ||
| 4621 | @c http://debbugs.gnu.org/9045 | ||
| 4622 | @c And if you have both compiled in, then you always get | ||
| 4623 | @c the libjpeg version: | ||
| 4624 | @c http://debbugs.gnu.org/10746 | ||
| 4625 | There may be overlap between image loaders in your Emacs installation, | ||
| 4626 | and you may prefer to use a different one for a given image type | ||
| 4627 | (which loader will be used in practice depends on the priority of the | ||
| 4628 | loaders). | ||
| 4629 | For example, if you never want to use the ImageMagick loader to view | ||
| 4630 | JPEG files, add @code{JPG} to this list. | ||
| 4631 | @end ignore | ||
| 4632 | |||
| 4633 | Images loaded with ImageMagick support the following additional | 4611 | Images loaded with ImageMagick support the following additional |
| 4634 | image descriptor properties: | 4612 | image descriptor properties: |
| 4635 | 4613 | ||
| @@ -137,16 +137,16 @@ It is no longer necessary to call `imagemagick-register-types' | |||
| 137 | explicitly to install ImageMagick image types; that function is called | 137 | explicitly to install ImageMagick image types; that function is called |
| 138 | automatically at startup, or when customizing a relevant imagemagick- | 138 | automatically at startup, or when customizing a relevant imagemagick- |
| 139 | option. | 139 | option. |
| 140 | 140 | +++ | |
| 141 | *** Setting `imagemagick-types-inhibit' to t now disables the use of | 141 | *** Setting `imagemagick-types-inhibit' to t now disables the use of |
| 142 | ImageMagick to view images. You must call imagemagick-register-types | 142 | ImageMagick to view images. You must call imagemagick-register-types |
| 143 | afterwards if you do not use customize to change this. | 143 | afterwards if you do not use customize to change this. |
| 144 | 144 | +++ | |
| 145 | *** The new variable `imagemagick-enabled-types' also affects which | 145 | *** The new variable `imagemagick-enabled-types' also affects which |
| 146 | ImageMagick types are treated as images. The function | 146 | ImageMagick types are treated as images. The function |
| 147 | `imagemagick-filter-types' returns the list of types that will be | 147 | `imagemagick-filter-types' returns the list of types that will be |
| 148 | treated as images. | 148 | treated as images. |
| 149 | 149 | --- | |
| 150 | *** Images displayed via ImageMagick now support transparency and the | 150 | *** Images displayed via ImageMagick now support transparency and the |
| 151 | :background image spec property. | 151 | :background image spec property. |
| 152 | 152 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2a92c1178cf..d58eb0bfbbf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2012-10-13 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * textmodes/ispell.el (ispell-pdict-save): If flyspell-mode is | ||
| 4 | enabled, re-enable it (Bug#11963). | ||
| 5 | |||
| 6 | 2012-10-13 Martin Rudalics <rudalics@gmx.at> | ||
| 7 | |||
| 8 | * emacs-lisp/debug.el (debug): When debugger-will-be-back is | ||
| 9 | non-nil, restore window configuration (Bug#12623). | ||
| 10 | |||
| 1 | 2012-10-12 Stefan Monnier <monnier@iro.umontreal.ca> | 11 | 2012-10-12 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 12 | ||
| 3 | * help-fns.el (describe-variable, describe-function-1): | 13 | * help-fns.el (describe-variable, describe-function-1): |
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 6b308119abb..c30ccf3315e 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el | |||
| @@ -213,7 +213,8 @@ first will be printed into the backtrace buffer." | |||
| 213 | (or enable-recursive-minibuffers (> (minibuffer-depth) 0))) | 213 | (or enable-recursive-minibuffers (> (minibuffer-depth) 0))) |
| 214 | (standard-input t) (standard-output t) | 214 | (standard-input t) (standard-output t) |
| 215 | inhibit-redisplay | 215 | inhibit-redisplay |
| 216 | (cursor-in-echo-area nil)) | 216 | (cursor-in-echo-area nil) |
| 217 | (window-configuration (current-window-configuration))) | ||
| 217 | (unwind-protect | 218 | (unwind-protect |
| 218 | (save-excursion | 219 | (save-excursion |
| 219 | (when (eq (car debugger-args) 'debug) | 220 | (when (eq (car debugger-args) 'debug) |
| @@ -266,16 +267,19 @@ first will be printed into the backtrace buffer." | |||
| 266 | ;; Make sure we unbind buffer-read-only in the right buffer. | 267 | ;; Make sure we unbind buffer-read-only in the right buffer. |
| 267 | (save-excursion | 268 | (save-excursion |
| 268 | (recursive-edit)))) | 269 | (recursive-edit)))) |
| 269 | (when (and (not debugger-will-be-back) | 270 | (if debugger-will-be-back |
| 270 | (window-live-p debugger-window) | 271 | ;; Restore previous window configuration (Bug#12623). |
| 271 | (eq (window-buffer debugger-window) debugger-buffer)) | 272 | (set-window-configuration window-configuration) |
| 272 | ;; Record height of debugger window. | 273 | (when (and (window-live-p debugger-window) |
| 273 | (setq debugger-previous-window-height | 274 | (eq (window-buffer debugger-window) debugger-buffer)) |
| 274 | (window-total-size debugger-window)) | 275 | (progn |
| 275 | ;; Unshow debugger-buffer. | 276 | ;; Record height of debugger window. |
| 276 | (quit-restore-window debugger-window debugger-bury-or-kill) | 277 | (setq debugger-previous-window-height |
| 277 | ;; Restore current buffer (Bug#12502). | 278 | (window-total-size debugger-window)) |
| 278 | (set-buffer debugger-old-buffer)) | 279 | ;; Unshow debugger-buffer. |
| 280 | (quit-restore-window debugger-window debugger-bury-or-kill) | ||
| 281 | ;; Restore current buffer (Bug#12502). | ||
| 282 | (set-buffer debugger-old-buffer)))) | ||
| 279 | ;; Restore previous state of debugger-buffer in case we were | 283 | ;; Restore previous state of debugger-buffer in case we were |
| 280 | ;; in a recursive invocation of the debugger, otherwise just | 284 | ;; in a recursive invocation of the debugger, otherwise just |
| 281 | ;; erase the buffer and put it into fundamental mode. | 285 | ;; erase the buffer and put it into fundamental mode. |
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 51a4800de52..d591dc5fa85 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -1893,11 +1893,14 @@ If so, ask if it needs to be saved." | |||
| 1893 | (interactive (list ispell-silently-savep t)) | 1893 | (interactive (list ispell-silently-savep t)) |
| 1894 | (if (and ispell-pdict-modified-p (listp ispell-pdict-modified-p)) | 1894 | (if (and ispell-pdict-modified-p (listp ispell-pdict-modified-p)) |
| 1895 | (setq ispell-pdict-modified-p (car ispell-pdict-modified-p))) | 1895 | (setq ispell-pdict-modified-p (car ispell-pdict-modified-p))) |
| 1896 | (if (or ispell-pdict-modified-p force-save) | 1896 | (when (and (or ispell-pdict-modified-p force-save) |
| 1897 | (if (or no-query (y-or-n-p "Personal dictionary modified. Save? ")) | 1897 | (or no-query |
| 1898 | (progn | 1898 | (y-or-n-p "Personal dictionary modified. Save? "))) |
| 1899 | (ispell-send-string "#\n") ; save dictionary | 1899 | (ispell-send-string "#\n") ; save dictionary |
| 1900 | (message "Personal dictionary saved.")))) | 1900 | (message "Personal dictionary saved.") |
| 1901 | (when flyspell-mode | ||
| 1902 | (flyspell-mode 0) | ||
| 1903 | (flyspell-mode 1))) | ||
| 1901 | ;; unassert variable, even if not saved to avoid questioning. | 1904 | ;; unassert variable, even if not saved to avoid questioning. |
| 1902 | (setq ispell-pdict-modified-p nil)) | 1905 | (setq ispell-pdict-modified-p nil)) |
| 1903 | 1906 | ||
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index c7fc4fcbfe1..59222bcc957 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2012-10-13 Liam Stitt <stittl@cuug.ab.ca> (tiny change) | ||
| 2 | |||
| 3 | * url-vars.el (url-uncompressor-alist): | ||
| 4 | * url-file.el (url-file-find-possibly-compressed-file, url-file): | ||
| 5 | Recognize .xz compression (Bug#11839). | ||
| 6 | |||
| 7 | 2012-10-13 Chong Yidong <cyd@gnu.org> | ||
| 8 | |||
| 9 | * url-http.el (url-http): | ||
| 10 | * url.el (url-retrieve-internal): Doc fix (Bug#6407). | ||
| 11 | |||
| 1 | 2012-10-08 Glenn Morris <rgm@gnu.org> | 12 | 2012-10-08 Glenn Morris <rgm@gnu.org> |
| 2 | 13 | ||
| 3 | * url-methods.el (url-scheme-get-property): url-https.el was | 14 | * url-methods.el (url-scheme-get-property): url-https.el was |
diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el index 4bbbdcf200c..3515d7493cc 100644 --- a/lisp/url/url-file.el +++ b/lisp/url/url-file.el | |||
| @@ -40,7 +40,7 @@ can do automatic decompression for them, and won't find 'foo' if | |||
| 40 | 'foo.gz' exists, even though the FTP server would happily serve it up | 40 | 'foo.gz' exists, even though the FTP server would happily serve it up |
| 41 | to them." | 41 | to them." |
| 42 | (let ((scratch nil) | 42 | (let ((scratch nil) |
| 43 | (compressed-extensions '("" ".gz" ".z" ".Z" ".bz2")) | 43 | (compressed-extensions '("" ".gz" ".z" ".Z" ".bz2" ".xz")) |
| 44 | (found nil)) | 44 | (found nil)) |
| 45 | (while (and compressed-extensions (not found)) | 45 | (while (and compressed-extensions (not found)) |
| 46 | (if (file-exists-p (setq scratch (concat fname (pop compressed-extensions)))) | 46 | (if (file-exists-p (setq scratch (concat fname (pop compressed-extensions)))) |
| @@ -177,6 +177,7 @@ to them." | |||
| 177 | (".uue" "x-uuencoded") | 177 | (".uue" "x-uuencoded") |
| 178 | (".hqx" "x-hqx") | 178 | (".hqx" "x-hqx") |
| 179 | (".bz2" "x-bzip2") | 179 | (".bz2" "x-bzip2") |
| 180 | (".xz" "x-xz") | ||
| 180 | (_ nil))) | 181 | (_ nil))) |
| 181 | 182 | ||
| 182 | (if (file-directory-p filename) | 183 | (if (file-directory-p filename) |
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 85b6efcde0d..73d53e08c59 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el | |||
| @@ -1150,8 +1150,12 @@ the end of the document." | |||
| 1150 | (defun url-http (url callback cbargs &optional retry-buffer) | 1150 | (defun url-http (url callback cbargs &optional retry-buffer) |
| 1151 | "Retrieve URL via HTTP asynchronously. | 1151 | "Retrieve URL via HTTP asynchronously. |
| 1152 | URL must be a parsed URL. See `url-generic-parse-url' for details. | 1152 | URL must be a parsed URL. See `url-generic-parse-url' for details. |
| 1153 | When retrieval is completed, the function CALLBACK is executed with | 1153 | |
| 1154 | CBARGS as the arguments. | 1154 | When retrieval is completed, execute the function CALLBACK, using |
| 1155 | the arguments listed in CBARGS. The first element in CBARGS | ||
| 1156 | should be a plist describing what has happened so far during the | ||
| 1157 | request, as described in the docstring of `url-retrieve' (if in | ||
| 1158 | doubt, specify nil). | ||
| 1155 | 1159 | ||
| 1156 | Optional arg RETRY-BUFFER, if non-nil, specifies the buffer of a | 1160 | Optional arg RETRY-BUFFER, if non-nil, specifies the buffer of a |
| 1157 | previous `url-http' call, which is being re-attempted." | 1161 | previous `url-http' call, which is being re-attempted." |
diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el index 29f1e2cde0c..fdfd0e9868d 100644 --- a/lisp/url/url-vars.el +++ b/lisp/url/url-vars.el | |||
| @@ -152,7 +152,8 @@ variable." | |||
| 152 | (".uue" . "x-uuencoded") | 152 | (".uue" . "x-uuencoded") |
| 153 | (".hqx" . "x-hqx") | 153 | (".hqx" . "x-hqx") |
| 154 | (".Z" . "x-compress") | 154 | (".Z" . "x-compress") |
| 155 | (".bz2" . "x-bzip2")) | 155 | (".bz2" . "x-bzip2") |
| 156 | (".xz" . "x-xz")) | ||
| 156 | "An alist of file extensions and appropriate content-transfer-encodings." | 157 | "An alist of file extensions and appropriate content-transfer-encodings." |
| 157 | :type '(repeat (cons :format "%v" | 158 | :type '(repeat (cons :format "%v" |
| 158 | (string :tag "Extension") | 159 | (string :tag "Extension") |
diff --git a/lisp/url/url.el b/lisp/url/url.el index 87ae7a51aac..b219151a30c 100644 --- a/lisp/url/url.el +++ b/lisp/url/url.el | |||
| @@ -131,9 +131,9 @@ characters are percent-encoded; see `url-encode-url'. | |||
| 131 | CALLBACK is called when the object has been completely retrieved, with | 131 | CALLBACK is called when the object has been completely retrieved, with |
| 132 | the current buffer containing the object, and any MIME headers associated | 132 | the current buffer containing the object, and any MIME headers associated |
| 133 | with it. It is called as (apply CALLBACK STATUS CBARGS). | 133 | with it. It is called as (apply CALLBACK STATUS CBARGS). |
| 134 | STATUS is a list with an even number of elements representing | 134 | STATUS is a plist representing what happened during the request, |
| 135 | what happened during the request, with most recent events first, | 135 | with most recent events first, or an empty list if no events have |
| 136 | or an empty list if no events have occurred. Each pair is one of: | 136 | occurred. Each pair is one of: |
| 137 | 137 | ||
| 138 | \(:redirect REDIRECTED-TO) - the request was redirected to this URL | 138 | \(:redirect REDIRECTED-TO) - the request was redirected to this URL |
| 139 | \(:error (ERROR-SYMBOL . DATA)) - an error occurred. The error can be | 139 | \(:error (ERROR-SYMBOL . DATA)) - an error occurred. The error can be |
| @@ -169,8 +169,10 @@ URL-encoded before it's used." | |||
| 169 | (defun url-retrieve-internal (url callback cbargs &optional silent | 169 | (defun url-retrieve-internal (url callback cbargs &optional silent |
| 170 | inhibit-cookies) | 170 | inhibit-cookies) |
| 171 | "Internal function; external interface is `url-retrieve'. | 171 | "Internal function; external interface is `url-retrieve'. |
| 172 | CBARGS is what the callback will actually receive - the first item is | 172 | CBARGS is the list of arguments that the callback function will |
| 173 | the list of events, as described in the docstring of `url-retrieve'. | 173 | receive; its first element should be a plist specifying what has |
| 174 | happened so far during the request, as described in the docstring | ||
| 175 | of `url-retrieve' (if in doubt, specify nil). | ||
| 174 | 176 | ||
| 175 | If SILENT, don't message progress reports and the like. | 177 | If SILENT, don't message progress reports and the like. |
| 176 | If INHIBIT-COOKIES, cookies will neither be stored nor sent to | 178 | If INHIBIT-COOKIES, cookies will neither be stored nor sent to |
diff --git a/src/ChangeLog b/src/ChangeLog index 3787e006c4f..56131aca4b2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -3,6 +3,23 @@ | |||
| 3 | * coding.c (detect_coding): Set coding->id before calling | 3 | * coding.c (detect_coding): Set coding->id before calling |
| 4 | this->detector. | 4 | this->detector. |
| 5 | 5 | ||
| 6 | 2012-10-13 Andreas Schwab <schwab@linux-m68k.org> | ||
| 7 | |||
| 8 | * fileio.c: Formatting fixes. | ||
| 9 | |||
| 10 | 2012-10-13 Paul Eggert <eggert@cs.ucla.edu> | ||
| 11 | |||
| 12 | Fix some stat-related races. | ||
| 13 | * fileio.c (Fwrite_region): Avoid race condition if a file is | ||
| 14 | removed or renamed by some other process immediately after Emacs | ||
| 15 | writes it but before Emacs stats it. Do not assume that stat (or | ||
| 16 | fstat) succeeds. | ||
| 17 | * image.c (slurp_file): Resolve the file name with fopen + fstat | ||
| 18 | rather than stat + fopen. | ||
| 19 | (pbm_read_file) [0]: Remove unused code with stat race. | ||
| 20 | * process.c (allocate_pty) [HAVE_PTYS && !PTY_ITERATION && !PTY_OPEN]: | ||
| 21 | Remove ineffective code with stat race. | ||
| 22 | |||
| 6 | 2012-10-12 Stefan Monnier <monnier@iro.umontreal.ca> | 23 | 2012-10-12 Stefan Monnier <monnier@iro.umontreal.ca> |
| 7 | 24 | ||
| 8 | * doc.c (get_doc_string): Don't signal an error if the file is missing. | 25 | * doc.c (get_doc_string): Don't signal an error if the file is missing. |
diff --git a/src/fileio.c b/src/fileio.c index 5de5bc2b021..e3a91c2c9da 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -1370,8 +1370,7 @@ See also the function `substitute-in-file-name'.") | |||
| 1370 | p = nm; | 1370 | p = nm; |
| 1371 | while (*p) | 1371 | while (*p) |
| 1372 | { | 1372 | { |
| 1373 | if (p[0] == '/' && p[1] == '/' | 1373 | if (p[0] == '/' && p[1] == '/') |
| 1374 | ) | ||
| 1375 | nm = p + 1; | 1374 | nm = p + 1; |
| 1376 | if (p[0] == '/' && p[1] == '~') | 1375 | if (p[0] == '/' && p[1] == '~') |
| 1377 | nm = p + 1, lose = 1; | 1376 | nm = p + 1, lose = 1; |
| @@ -1510,17 +1509,16 @@ search_embedded_absfilename (char *nm, char *endp) | |||
| 1510 | 1509 | ||
| 1511 | for (p = nm + 1; p < endp; p++) | 1510 | for (p = nm + 1; p < endp; p++) |
| 1512 | { | 1511 | { |
| 1513 | if ((0 | 1512 | if (IS_DIRECTORY_SEP (p[-1]) |
| 1514 | || IS_DIRECTORY_SEP (p[-1])) | ||
| 1515 | && file_name_absolute_p (p) | 1513 | && file_name_absolute_p (p) |
| 1516 | #if defined (WINDOWSNT) || defined (CYGWIN) | 1514 | #if defined (WINDOWSNT) || defined (CYGWIN) |
| 1517 | /* // at start of file name is meaningful in Apollo, | 1515 | /* // at start of file name is meaningful in Apollo, |
| 1518 | WindowsNT and Cygwin systems. */ | 1516 | WindowsNT and Cygwin systems. */ |
| 1519 | && !(IS_DIRECTORY_SEP (p[0]) && p - 1 == nm) | 1517 | && !(IS_DIRECTORY_SEP (p[0]) && p - 1 == nm) |
| 1520 | #endif /* not (WINDOWSNT || CYGWIN) */ | 1518 | #endif /* not (WINDOWSNT || CYGWIN) */ |
| 1521 | ) | 1519 | ) |
| 1522 | { | 1520 | { |
| 1523 | for (s = p; *s && (!IS_DIRECTORY_SEP (*s)); s++); | 1521 | for (s = p; *s && !IS_DIRECTORY_SEP (*s); s++); |
| 1524 | if (p[0] == '~' && s > p + 1) /* We've got "/~something/". */ | 1522 | if (p[0] == '~' && s > p + 1) /* We've got "/~something/". */ |
| 1525 | { | 1523 | { |
| 1526 | char *o = alloca (s - p + 1); | 1524 | char *o = alloca (s - p + 1); |
| @@ -1735,7 +1733,7 @@ those `/' is discarded. */) | |||
| 1735 | *x = 0; | 1733 | *x = 0; |
| 1736 | 1734 | ||
| 1737 | /* If /~ or // appears, discard everything through first slash. */ | 1735 | /* If /~ or // appears, discard everything through first slash. */ |
| 1738 | while ((p = search_embedded_absfilename (xnm, x))) | 1736 | while ((p = search_embedded_absfilename (xnm, x)) != NULL) |
| 1739 | /* This time we do not start over because we've already expanded envvars | 1737 | /* This time we do not start over because we've already expanded envvars |
| 1740 | and replaced $$ with $. Maybe we should start over as well, but we'd | 1738 | and replaced $$ with $. Maybe we should start over as well, but we'd |
| 1741 | need to quote some $ to $$ first. */ | 1739 | need to quote some $ to $$ first. */ |
| @@ -2169,7 +2167,7 @@ With a prefix argument, TRASH is nil. */) | |||
| 2169 | 2167 | ||
| 2170 | encoded_file = ENCODE_FILE (filename); | 2168 | encoded_file = ENCODE_FILE (filename); |
| 2171 | 2169 | ||
| 2172 | if (0 > unlink (SSDATA (encoded_file))) | 2170 | if (unlink (SSDATA (encoded_file)) < 0) |
| 2173 | report_file_error ("Removing old name", list1 (filename)); | 2171 | report_file_error ("Removing old name", list1 (filename)); |
| 2174 | return Qnil; | 2172 | return Qnil; |
| 2175 | } | 2173 | } |
| @@ -2218,8 +2216,8 @@ This is what happens in interactive use with M-x. */) | |||
| 2218 | #endif | 2216 | #endif |
| 2219 | ) | 2217 | ) |
| 2220 | { | 2218 | { |
| 2221 | Lisp_Object fname = NILP (Ffile_directory_p (file)) | 2219 | Lisp_Object fname = (NILP (Ffile_directory_p (file)) |
| 2222 | ? file : Fdirectory_file_name (file); | 2220 | ? file : Fdirectory_file_name (file)); |
| 2223 | newname = Fexpand_file_name (Ffile_name_nondirectory (fname), newname); | 2221 | newname = Fexpand_file_name (Ffile_name_nondirectory (fname), newname); |
| 2224 | } | 2222 | } |
| 2225 | else | 2223 | else |
| @@ -2247,7 +2245,7 @@ This is what happens in interactive use with M-x. */) | |||
| 2247 | || INTEGERP (ok_if_already_exists)) | 2245 | || INTEGERP (ok_if_already_exists)) |
| 2248 | barf_or_query_if_file_exists (newname, "rename to it", | 2246 | barf_or_query_if_file_exists (newname, "rename to it", |
| 2249 | INTEGERP (ok_if_already_exists), 0, 0); | 2247 | INTEGERP (ok_if_already_exists), 0, 0); |
| 2250 | if (0 > rename (SSDATA (encoded_file), SSDATA (encoded_newname))) | 2248 | if (rename (SSDATA (encoded_file), SSDATA (encoded_newname)) < 0) |
| 2251 | { | 2249 | { |
| 2252 | if (errno == EXDEV) | 2250 | if (errno == EXDEV) |
| 2253 | { | 2251 | { |
| @@ -2328,7 +2326,7 @@ This is what happens in interactive use with M-x. */) | |||
| 2328 | INTEGERP (ok_if_already_exists), 0, 0); | 2326 | INTEGERP (ok_if_already_exists), 0, 0); |
| 2329 | 2327 | ||
| 2330 | unlink (SSDATA (newname)); | 2328 | unlink (SSDATA (newname)); |
| 2331 | if (0 > link (SSDATA (encoded_file), SSDATA (encoded_newname))) | 2329 | if (link (SSDATA (encoded_file), SSDATA (encoded_newname)) < 0) |
| 2332 | report_file_error ("Adding new name", list2 (file, newname)); | 2330 | report_file_error ("Adding new name", list2 (file, newname)); |
| 2333 | 2331 | ||
| 2334 | UNGCPRO; | 2332 | UNGCPRO; |
| @@ -2385,15 +2383,14 @@ This happens for interactive use with M-x. */) | |||
| 2385 | || INTEGERP (ok_if_already_exists)) | 2383 | || INTEGERP (ok_if_already_exists)) |
| 2386 | barf_or_query_if_file_exists (linkname, "make it a link", | 2384 | barf_or_query_if_file_exists (linkname, "make it a link", |
| 2387 | INTEGERP (ok_if_already_exists), 0, 0); | 2385 | INTEGERP (ok_if_already_exists), 0, 0); |
| 2388 | if (0 > symlink (SSDATA (encoded_filename), | 2386 | if (symlink (SSDATA (encoded_filename), SSDATA (encoded_linkname)) < 0) |
| 2389 | SSDATA (encoded_linkname))) | ||
| 2390 | { | 2387 | { |
| 2391 | /* If we didn't complain already, silently delete existing file. */ | 2388 | /* If we didn't complain already, silently delete existing file. */ |
| 2392 | if (errno == EEXIST) | 2389 | if (errno == EEXIST) |
| 2393 | { | 2390 | { |
| 2394 | unlink (SSDATA (encoded_linkname)); | 2391 | unlink (SSDATA (encoded_linkname)); |
| 2395 | if (0 <= symlink (SSDATA (encoded_filename), | 2392 | if (symlink (SSDATA (encoded_filename), SSDATA (encoded_linkname)) |
| 2396 | SSDATA (encoded_linkname))) | 2393 | >= 0) |
| 2397 | { | 2394 | { |
| 2398 | UNGCPRO; | 2395 | UNGCPRO; |
| 2399 | return Qnil; | 2396 | return Qnil; |
| @@ -3203,7 +3200,7 @@ emacs_lseek (int fd, EMACS_INT offset, int whence) | |||
| 3203 | { | 3200 | { |
| 3204 | /* Use "&" rather than "&&" to suppress a bogus GCC warning; see | 3201 | /* Use "&" rather than "&&" to suppress a bogus GCC warning; see |
| 3205 | <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772>. */ | 3202 | <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772>. */ |
| 3206 | if (! ((TYPE_MINIMUM (off_t) <= offset) & (offset <= TYPE_MAXIMUM (off_t)))) | 3203 | if (! ((offset >= TYPE_MINIMUM (off_t)) & (offset <= TYPE_MAXIMUM (off_t)))) |
| 3207 | { | 3204 | { |
| 3208 | errno = EINVAL; | 3205 | errno = EINVAL; |
| 3209 | return -1; | 3206 | return -1; |
| @@ -3376,7 +3373,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3376 | 3373 | ||
| 3377 | if (!NILP (beg)) | 3374 | if (!NILP (beg)) |
| 3378 | { | 3375 | { |
| 3379 | if (! (RANGED_INTEGERP (0, beg, TYPE_MAXIMUM (off_t)))) | 3376 | if (! RANGED_INTEGERP (0, beg, TYPE_MAXIMUM (off_t))) |
| 3380 | wrong_type_argument (intern ("file-offset"), beg); | 3377 | wrong_type_argument (intern ("file-offset"), beg); |
| 3381 | beg_offset = XFASTINT (beg); | 3378 | beg_offset = XFASTINT (beg); |
| 3382 | } | 3379 | } |
| @@ -3385,7 +3382,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3385 | 3382 | ||
| 3386 | if (!NILP (end)) | 3383 | if (!NILP (end)) |
| 3387 | { | 3384 | { |
| 3388 | if (! (RANGED_INTEGERP (0, end, TYPE_MAXIMUM (off_t)))) | 3385 | if (! RANGED_INTEGERP (0, end, TYPE_MAXIMUM (off_t))) |
| 3389 | wrong_type_argument (intern ("file-offset"), end); | 3386 | wrong_type_argument (intern ("file-offset"), end); |
| 3390 | end_offset = XFASTINT (end); | 3387 | end_offset = XFASTINT (end); |
| 3391 | } | 3388 | } |
| @@ -3421,8 +3418,8 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3421 | 3418 | ||
| 3422 | if (beg_offset < likely_end) | 3419 | if (beg_offset < likely_end) |
| 3423 | { | 3420 | { |
| 3424 | ptrdiff_t buf_bytes = | 3421 | ptrdiff_t buf_bytes |
| 3425 | Z_BYTE - (!NILP (replace) ? ZV_BYTE - BEGV_BYTE : 0); | 3422 | = Z_BYTE - (!NILP (replace) ? ZV_BYTE - BEGV_BYTE : 0); |
| 3426 | ptrdiff_t buf_growth_max = BUF_BYTES_MAX - buf_bytes; | 3423 | ptrdiff_t buf_growth_max = BUF_BYTES_MAX - buf_bytes; |
| 3427 | off_t likely_growth = likely_end - beg_offset; | 3424 | off_t likely_growth = likely_end - beg_offset; |
| 3428 | if (buf_growth_max < likely_growth) | 3425 | if (buf_growth_max < likely_growth) |
| @@ -4545,6 +4542,7 @@ This calls `write-region-annotate-functions' at the start, and | |||
| 4545 | int save_errno = 0; | 4542 | int save_errno = 0; |
| 4546 | const char *fn; | 4543 | const char *fn; |
| 4547 | struct stat st; | 4544 | struct stat st; |
| 4545 | EMACS_TIME modtime; | ||
| 4548 | ptrdiff_t count = SPECPDL_INDEX (); | 4546 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4549 | int count1; | 4547 | int count1; |
| 4550 | Lisp_Object handler; | 4548 | Lisp_Object handler; |
| @@ -4757,12 +4755,19 @@ This calls `write-region-annotate-functions' at the start, and | |||
| 4757 | } | 4755 | } |
| 4758 | #endif | 4756 | #endif |
| 4759 | 4757 | ||
| 4758 | modtime = invalid_emacs_time (); | ||
| 4759 | if (visiting) | ||
| 4760 | { | ||
| 4761 | if (fstat (desc, &st) == 0) | ||
| 4762 | modtime = get_stat_mtime (&st); | ||
| 4763 | else | ||
| 4764 | ok = 0, save_errno = errno; | ||
| 4765 | } | ||
| 4766 | |||
| 4760 | /* NFS can report a write failure now. */ | 4767 | /* NFS can report a write failure now. */ |
| 4761 | if (emacs_close (desc) < 0) | 4768 | if (emacs_close (desc) < 0) |
| 4762 | ok = 0, save_errno = errno; | 4769 | ok = 0, save_errno = errno; |
| 4763 | 4770 | ||
| 4764 | stat (fn, &st); | ||
| 4765 | |||
| 4766 | /* Discard the unwind protect for close_file_unwind. */ | 4771 | /* Discard the unwind protect for close_file_unwind. */ |
| 4767 | specpdl_ptr = specpdl + count1; | 4772 | specpdl_ptr = specpdl + count1; |
| 4768 | 4773 | ||
| @@ -4790,9 +4795,9 @@ This calls `write-region-annotate-functions' at the start, and | |||
| 4790 | /* Do this before reporting IO error | 4795 | /* Do this before reporting IO error |
| 4791 | to avoid a "file has changed on disk" warning on | 4796 | to avoid a "file has changed on disk" warning on |
| 4792 | next attempt to save. */ | 4797 | next attempt to save. */ |
| 4793 | if (visiting) | 4798 | if (EMACS_TIME_VALID_P (modtime)) |
| 4794 | { | 4799 | { |
| 4795 | current_buffer->modtime = get_stat_mtime (&st); | 4800 | current_buffer->modtime = modtime; |
| 4796 | current_buffer->modtime_size = st.st_size; | 4801 | current_buffer->modtime_size = st.st_size; |
| 4797 | } | 4802 | } |
| 4798 | 4803 | ||
| @@ -5042,12 +5047,12 @@ e_write (int desc, Lisp_Object string, ptrdiff_t start, ptrdiff_t end, | |||
| 5042 | 5047 | ||
| 5043 | if (coding->produced > 0) | 5048 | if (coding->produced > 0) |
| 5044 | { | 5049 | { |
| 5045 | coding->produced -= | 5050 | coding->produced |
| 5046 | emacs_write (desc, | 5051 | -= emacs_write (desc, |
| 5047 | STRINGP (coding->dst_object) | 5052 | STRINGP (coding->dst_object) |
| 5048 | ? SSDATA (coding->dst_object) | 5053 | ? SSDATA (coding->dst_object) |
| 5049 | : (char *) BYTE_POS_ADDR (coding->dst_pos_byte), | 5054 | : (char *) BYTE_POS_ADDR (coding->dst_pos_byte), |
| 5050 | coding->produced); | 5055 | coding->produced); |
| 5051 | 5056 | ||
| 5052 | if (coding->produced) | 5057 | if (coding->produced) |
| 5053 | return 0; | 5058 | return 0; |
| @@ -5226,8 +5231,8 @@ auto_save_1 (void) | |||
| 5226 | if (stat (SSDATA (BVAR (current_buffer, filename)), &st) >= 0) | 5231 | if (stat (SSDATA (BVAR (current_buffer, filename)), &st) >= 0) |
| 5227 | /* But make sure we can overwrite it later! */ | 5232 | /* But make sure we can overwrite it later! */ |
| 5228 | auto_save_mode_bits = (st.st_mode | 0600) & 0777; | 5233 | auto_save_mode_bits = (st.st_mode | 0600) & 0777; |
| 5229 | else if ((modes = Ffile_modes (BVAR (current_buffer, filename)), | 5234 | else if (modes = Ffile_modes (BVAR (current_buffer, filename)), |
| 5230 | INTEGERP (modes))) | 5235 | INTEGERP (modes)) |
| 5231 | /* Remote files don't cooperate with stat. */ | 5236 | /* Remote files don't cooperate with stat. */ |
| 5232 | auto_save_mode_bits = (XINT (modes) | 0600) & 0777; | 5237 | auto_save_mode_bits = (XINT (modes) | 0600) & 0777; |
| 5233 | } | 5238 | } |
diff --git a/src/image.c b/src/image.c index 9b41cf74993..d52c3a29a27 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -2140,12 +2140,11 @@ x_find_image_file (Lisp_Object file) | |||
| 2140 | static unsigned char * | 2140 | static unsigned char * |
| 2141 | slurp_file (char *file, ptrdiff_t *size) | 2141 | slurp_file (char *file, ptrdiff_t *size) |
| 2142 | { | 2142 | { |
| 2143 | FILE *fp = NULL; | 2143 | FILE *fp = fopen (file, "rb"); |
| 2144 | unsigned char *buf = NULL; | 2144 | unsigned char *buf = NULL; |
| 2145 | struct stat st; | 2145 | struct stat st; |
| 2146 | 2146 | ||
| 2147 | if (stat (file, &st) == 0 | 2147 | if (fp && fstat (fileno (fp), &st) == 0 |
| 2148 | && (fp = fopen (file, "rb")) != NULL | ||
| 2149 | && 0 <= st.st_size && st.st_size <= min (PTRDIFF_MAX, SIZE_MAX) | 2148 | && 0 <= st.st_size && st.st_size <= min (PTRDIFF_MAX, SIZE_MAX) |
| 2150 | && (buf = xmalloc (st.st_size), | 2149 | && (buf = xmalloc (st.st_size), |
| 2151 | fread (buf, 1, st.st_size, fp) == st.st_size)) | 2150 | fread (buf, 1, st.st_size, fp) == st.st_size)) |
| @@ -5004,45 +5003,6 @@ pbm_scan_number (unsigned char **s, unsigned char *end) | |||
| 5004 | } | 5003 | } |
| 5005 | 5004 | ||
| 5006 | 5005 | ||
| 5007 | #ifdef HAVE_NTGUI | ||
| 5008 | #if 0 /* Unused. ++kfs */ | ||
| 5009 | |||
| 5010 | /* Read FILE into memory. Value is a pointer to a buffer allocated | ||
| 5011 | with xmalloc holding FILE's contents. Value is null if an error | ||
| 5012 | occurred. *SIZE is set to the size of the file. */ | ||
| 5013 | |||
| 5014 | static char * | ||
| 5015 | pbm_read_file (Lisp_Object file, int *size) | ||
| 5016 | { | ||
| 5017 | FILE *fp = NULL; | ||
| 5018 | char *buf = NULL; | ||
| 5019 | struct stat st; | ||
| 5020 | |||
| 5021 | if (stat (SDATA (file), &st) == 0 | ||
| 5022 | && (fp = fopen (SDATA (file), "rb")) != NULL | ||
| 5023 | && 0 <= st.st_size && st.st_size <= min (PTRDIFF_MAX, SIZE_MAX) | ||
| 5024 | && (buf = xmalloc (st.st_size), | ||
| 5025 | fread (buf, 1, st.st_size, fp) == st.st_size)) | ||
| 5026 | { | ||
| 5027 | *size = st.st_size; | ||
| 5028 | fclose (fp); | ||
| 5029 | } | ||
| 5030 | else | ||
| 5031 | { | ||
| 5032 | if (fp) | ||
| 5033 | fclose (fp); | ||
| 5034 | if (buf) | ||
| 5035 | { | ||
| 5036 | xfree (buf); | ||
| 5037 | buf = NULL; | ||
| 5038 | } | ||
| 5039 | } | ||
| 5040 | |||
| 5041 | return buf; | ||
| 5042 | } | ||
| 5043 | #endif | ||
| 5044 | #endif /* HAVE_NTGUI */ | ||
| 5045 | |||
| 5046 | /* Load PBM image IMG for use on frame F. */ | 5006 | /* Load PBM image IMG for use on frame F. */ |
| 5047 | 5007 | ||
| 5048 | static bool | 5008 | static bool |
diff --git a/src/process.c b/src/process.c index 2cbce9d28ea..d45a2c6e8e0 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -646,23 +646,6 @@ allocate_pty (void) | |||
| 646 | PTY_OPEN; | 646 | PTY_OPEN; |
| 647 | #else /* no PTY_OPEN */ | 647 | #else /* no PTY_OPEN */ |
| 648 | { | 648 | { |
| 649 | { /* Some systems name their pseudoterminals so that there are gaps in | ||
| 650 | the usual sequence - for example, on HP9000/S700 systems, there | ||
| 651 | are no pseudoterminals with names ending in 'f'. So we wait for | ||
| 652 | three failures in a row before deciding that we've reached the | ||
| 653 | end of the ptys. */ | ||
| 654 | int failed_count = 0; | ||
| 655 | struct stat stb; | ||
| 656 | |||
| 657 | if (stat (pty_name, &stb) < 0) | ||
| 658 | { | ||
| 659 | failed_count++; | ||
| 660 | if (failed_count >= 3) | ||
| 661 | return -1; | ||
| 662 | } | ||
| 663 | else | ||
| 664 | failed_count = 0; | ||
| 665 | } | ||
| 666 | # ifdef O_NONBLOCK | 649 | # ifdef O_NONBLOCK |
| 667 | fd = emacs_open (pty_name, O_RDWR | O_NONBLOCK, 0); | 650 | fd = emacs_open (pty_name, O_RDWR | O_NONBLOCK, 0); |
| 668 | # else | 651 | # else |