Imported Upstream version 2.5.0
[debian/amanda] / common-src / token.c
index c56c9d199197f769853d5cd8e70d660ee7c9a802..d894f40575b614c9f586cbb9bae58882a403f4c8 100644 (file)
@@ -24,7 +24,7 @@
  * file named AUTHORS, in the root directory of this distribution.
  */
 /*
- * $Id: token.c,v 1.22.8.3 2003/10/22 17:32:33 kovert Exp $
+ * $Id: token.c,v 1.29 2006/01/14 04:37:19 paddy_s Exp $
  *
  * token bashing routines
  */
@@ -141,7 +141,7 @@ printf_arglist_function(char *squotef, char *, format)
        /* Format the token */
 
        arglist_start(argp, format);
-       ap_vsnprintf(linebuf, sizeof(linebuf), format, argp);
+       vsnprintf(linebuf, sizeof(linebuf), format, argp);
        arglist_end(argp);
 
        return quote(" ", linebuf);
@@ -155,7 +155,7 @@ printf_arglist_function1(char *quotef, char *, sep, char *, format)
        /* Format the token */
 
        arglist_start(argp, format);
-       ap_vsnprintf(linebuf, sizeof(linebuf), format, argp);
+       vsnprintf(linebuf, sizeof(linebuf), format, argp);
        arglist_end(argp);
 
        return quote(sep, linebuf);
@@ -368,7 +368,7 @@ char *str;  /* the string to quote */
 
     return buf;
 }
-#endif /* HAVE_SHQUOTE */
+#endif
 
 /* Table lookup.
 */
@@ -408,20 +408,14 @@ int main()
        int r;
        char *sr;
        int i;
-       int fd;
-
-       for(fd = 3; fd < FD_SETSIZE; fd++) {
-               /*
-                * Make sure nobody spoofs us with a lot of extra open files
-                * that would cause an open we do to get a very high file
-                * descriptor, which in turn might be used as an index into
-                * an array (e.g. an fd_set).
-                */
-               close(fd);
-       }
+
+       safe_fd(-1, 0);
 
        set_pname("token test");
 
+       /* Don't die when child closes pipe */
+       signal(SIGPIPE, SIG_IGN);
+
        erroutput_type = ERR_INTERACTIVE;
 
        printf("Testing split() with \" \" token separator\n");