diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-07 21:11:46 -0400 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-12 21:26:35 -0400 |
commit | 74da141e618ef99959d509cb2e7be35a348a39db (patch) | |
tree | 88ebc38b381a1021fc2d74864a71e230ae591c3d /gl/m4/open.m4 | |
parent | c63a4f726a0b6ad8cf6040f947754a81fd4683bb (diff) | |
download | monitoring-plugins-74da141e618ef99959d509cb2e7be35a348a39db.tar.gz |
Sync with the latest Gnulib code (177f525)
Signed-off-by: Thomas Guyot-Sionnest <dermoth@aei.ca>
Diffstat (limited to 'gl/m4/open.m4')
-rw-r--r-- | gl/m4/open.m4 | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/gl/m4/open.m4 b/gl/m4/open.m4 index 6e286c96..d705b3a1 100644 --- a/gl/m4/open.m4 +++ b/gl/m4/open.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # open.m4 serial 5 | 1 | # open.m4 serial 8 |
2 | dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -13,10 +13,15 @@ AC_DEFUN([gl_FUNC_OPEN], | |||
13 | ;; | 13 | ;; |
14 | *) | 14 | *) |
15 | dnl open("foo/") should not create a file when the file name has a | 15 | dnl open("foo/") should not create a file when the file name has a |
16 | dnl trailing slash. | 16 | dnl trailing slash. FreeBSD only has the problem on symlinks. |
17 | AC_CHECK_FUNCS_ONCE([lstat]) | ||
17 | AC_CACHE_CHECK([whether open recognizes a trailing slash], | 18 | AC_CACHE_CHECK([whether open recognizes a trailing slash], |
18 | [gl_cv_func_open_slash], | 19 | [gl_cv_func_open_slash], |
19 | [ | 20 | [# Assume that if we have lstat, we can also check symlinks. |
21 | if test $ac_cv_func_lstat = yes; then | ||
22 | touch conftest.tmp | ||
23 | ln -s conftest.tmp conftest.lnk | ||
24 | fi | ||
20 | AC_TRY_RUN([ | 25 | AC_TRY_RUN([ |
21 | #include <fcntl.h> | 26 | #include <fcntl.h> |
22 | #if HAVE_UNISTD_H | 27 | #if HAVE_UNISTD_H |
@@ -24,18 +29,22 @@ AC_DEFUN([gl_FUNC_OPEN], | |||
24 | #endif | 29 | #endif |
25 | int main () | 30 | int main () |
26 | { | 31 | { |
32 | #if HAVE_LSTAT | ||
33 | if (open ("conftest.lnk/", O_RDONLY) != -1) return 2; | ||
34 | #endif | ||
27 | return open ("conftest.sl/", O_CREAT, 0600) >= 0; | 35 | return open ("conftest.sl/", O_CREAT, 0600) >= 0; |
28 | }], [gl_cv_func_open_slash=yes], [gl_cv_func_open_slash=no], | 36 | }], [gl_cv_func_open_slash=yes], [gl_cv_func_open_slash=no], |
29 | [ | 37 | [ |
30 | changequote(,)dnl | 38 | changequote(,)dnl |
31 | case "$host_os" in | 39 | case "$host_os" in |
40 | freebsd*) gl_cv_func_open_slash="guessing no" ;; | ||
32 | solaris2.[0-9]*) gl_cv_func_open_slash="guessing no" ;; | 41 | solaris2.[0-9]*) gl_cv_func_open_slash="guessing no" ;; |
33 | hpux*) gl_cv_func_open_slash="guessing no" ;; | 42 | hpux*) gl_cv_func_open_slash="guessing no" ;; |
34 | *) gl_cv_func_open_slash="guessing yes" ;; | 43 | *) gl_cv_func_open_slash="guessing yes" ;; |
35 | esac | 44 | esac |
36 | changequote([,])dnl | 45 | changequote([,])dnl |
37 | ]) | 46 | ]) |
38 | rm -f conftest.sl | 47 | rm -f conftest.sl conftest.tmp conftest.lnk |
39 | ]) | 48 | ]) |
40 | case "$gl_cv_func_open_slash" in | 49 | case "$gl_cv_func_open_slash" in |
41 | *no) | 50 | *no) |
@@ -51,16 +60,15 @@ changequote([,])dnl | |||
51 | AC_DEFUN([gl_REPLACE_OPEN], | 60 | AC_DEFUN([gl_REPLACE_OPEN], |
52 | [ | 61 | [ |
53 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) | 62 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) |
54 | if test $REPLACE_OPEN != 1; then | ||
55 | AC_LIBOBJ([open]) | ||
56 | gl_PREREQ_OPEN | ||
57 | fi | ||
58 | REPLACE_OPEN=1 | 63 | REPLACE_OPEN=1 |
64 | AC_LIBOBJ([open]) | ||
65 | gl_PREREQ_OPEN | ||
59 | ]) | 66 | ]) |
60 | 67 | ||
61 | # Prerequisites of lib/open.c. | 68 | # Prerequisites of lib/open.c. |
62 | AC_DEFUN([gl_PREREQ_OPEN], | 69 | AC_DEFUN([gl_PREREQ_OPEN], |
63 | [ | 70 | [ |
64 | AC_REQUIRE([AC_C_INLINE]) | 71 | AC_REQUIRE([AC_C_INLINE]) |
72 | AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T]) | ||
65 | : | 73 | : |
66 | ]) | 74 | ]) |