Imported Upstream version 2.4.5p1
[debian/amanda] / server-src / taper.c
index b110522b5995398aea8eecbfd5d7e20f1c855748..612e822012a86a21be9925ed26e985b85bbb6d4e 100644 (file)
@@ -23,7 +23,7 @@
  * Authors: the Amanda Development Team.  Its members are listed in a
  * file named AUTHORS, in the root directory of this distribution.
  */
-/* $Id: taper.c,v 1.47.2.14.4.8.2.17.2.1 2004/02/13 14:09:34 martinea Exp $
+/* $Id: taper.c,v 1.47.2.14.4.8.2.17.2.4 2005/10/11 11:10:20 martinea Exp $
  *
  * moves files from holding disk to tape, or from a socket to tape
  */
@@ -170,22 +170,13 @@ char **main_argv;
 {
     int p2c[2], c2p[2];                /* parent-to-child, child-to-parent pipes */
     char *conffile;
-    int fd;
     unsigned int size;
     int i;
     int j;
     int page_size;
     char *first_buffer;
 
-    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("taper");
 
@@ -805,7 +796,7 @@ void read_file(fd, handle, hostname, diskname, datestamp, level, port_flag)
                q = squote(errstr);
                putresult(TRYAGAIN, "%s %s\n", handle, q);
                amfree(q);
-               log_add(L_INFO, "retrying %s:%s.%d on new tape: %s",
+               log_add(L_INFO, "retrying %s:%s.%d on new tape due to: %s",
                        hostname, diskname, level, errstr);
                closing = 1;
                syncpipe_put('X');      /* X == buffer snafu, bail */
@@ -945,7 +936,7 @@ void read_file(fd, handle, hostname, diskname, datestamp, level, port_flag)
            q = squote(errstr);
            if(tok == 'T') {
                putresult(TRYAGAIN, "%s %s\n", handle, q);
-               log_add(L_INFO, "retrying %s:%s.%d on new tape: %s",
+               log_add(L_INFO, "retrying %s:%s.%d on new tape due to: %s",
                        hostname, diskname, level, errstr);
            } else {
                putresult(TAPE_ERROR, "%s %s\n", handle, q);
@@ -1225,6 +1216,7 @@ int getp, putp;
        case 'Q':
            end_tape(0);        /* XXX check results of end tape ?? */
            clear_tapelist();
+           detach_buffers(buffers);
            amfree(taper_datestamp);
            amfree(label);
            amfree(errstr);