Merge from vendor branch TNF:
[pkgsrc.git] / sysutils / amanda-server / patches / patch-af
1 $NetBSD$
2
3 --- changer-src/chg-scsi.c.orig Sat Sep 19 03:55:13 1998
4 +++ changer-src/chg-scsi.c      Mon Feb 22 20:00:39 1999
5 @@ -527,6 +527,15 @@
6  {
7    FILE *out=NULL;
8    int cnt=0;
9 +
10 +  /* if we have a long timeout, sleep a long time before access.
11 +   * This is avoid lots of error messages for drives which need a lot of time
12 +   */
13 +  if ((timeout /2) > 1) {
14 +       timeout = timeout / 2;
15 +       sleep(timeout);
16 +  }
17 +       
18    while ((cnt<timeout) && (NULL==(out=fopen(tapedev,"w+")))){
19      cnt++;
20      sleep(1);
21 @@ -634,7 +643,10 @@
22  
23      /* Get the configuration parameters */
24      if (tape_device[0] >= '0' && tape_device[0] <= '9' && tape_device[1] == 0){
25 -      read_config(changer_file,&chg);
26 +      if (read_config(changer_file,&chg) == -1) {
27 +       perror(changer_file);
28 +       exit(1);
29 +      }
30        confnum=atoi(tape_device);
31        use_slots    = chg.conf[confnum].end-chg.conf[confnum].start+1;
32        slot_offset  = chg.conf[confnum].start;
33 @@ -717,7 +729,7 @@
34                     if (need_eject)
35                       eject_tape(tape_device);
36                     (void)unload(fd, drive_num, oldtarget);
37 -                   if (ask_clean(tape_device,need_sleep))
38 +                   if (clean_slot != -1 && ask_clean(tape_device,need_sleep))
39                         clean_tape(fd,tape_device,clean_file,drive_num,
40                                     clean_slot,maxclean,time_file);
41                     loaded=0;
42 @@ -751,7 +763,7 @@
43                 if (need_eject)
44                     eject_tape(tape_device);
45                 (void)unload(fd, drive_num, target);
46 -               if (ask_clean(tape_device,need_sleep))
47 +               if (clean_slot != -1 && ask_clean(tape_device,need_sleep))
48                     clean_tape(fd,tape_device,clean_file,drive_num,clean_slot,
49                                 maxclean,time_file);
50             }
51 @@ -776,7 +788,7 @@
52                 if (need_eject)
53                   eject_tape(tape_device);
54                 (void)unload(fd, drive_num, target);
55 -               if (ask_clean(tape_device,need_sleep))
56 +               if (clean_slot != -1 && ask_clean(tape_device,need_sleep))
57                     clean_tape(fd,tape_device,clean_file,drive_num,clean_slot,
58                                 maxclean,time_file);
59                 printf("%d %s\n", target, tape_device);