Amanda-Users

Re: amrecover 2.5.1

2006-09-21 14:45:12
Subject: Re: amrecover 2.5.1
From: Jean-Louis Martineau <martineau AT zmanda DOT com>
To: Jean-Francois Malouin <Jean-Francois.Malouin AT bic.mni.mcgill DOT ca>
Date: Thu, 21 Sep 2006 14:35:01 -0400
Hi,

Irix doesn't have the same return value for vsnprintf as linux have.
Could you try this patch.

Jean-Louis

Jean-Francois Malouin wrote:
* Jean-Louis Martineau <martineau AT zmanda DOT com> [20060921 13:04]:
Jean-Francois,

Could you send the amrecover.<timestamp>.debug and amindexd.<timestamp>.debug files?

here they come attached.
jf

Jean-Louis

Jean-Francois Malouin wrote:
Hello,

amanda-2.5.1 on irix-6.5.x using bsdtcp auth
amrecover don't want to play ball:

yorick 130# /opt/amanda/amanda10/sbin/amrecover
AMRECOVER Version 2.5.1. Contacting server on yorick ...
220 Setting restore date to today (2006-09-21) 200 Scanning /holddisk/conf10/stk_180... 200 200 Use the setdisk command to choose dump disk to recover
amrecover> setdate 2006-09-20
200 amrecover> setdisk /data/nihpd/nihpd3/backup 200 bad reply: missing date field
oc!È
amrecover> ls
amrecover> pwd
/data/nihpd/nihpd3/backup
mrecover> listhost
200-
201-
200 amrecover> listdisk
200-
201-
[ large numbers of 201- lines ]
200 amrecover> add .
File . doesn't exist in directory


Now I'm nervous!
jf

diff -u -r --show-c-function --exclude-from=amanda.diff 
amanda-2.5.1.new/common-src/packet.c 
amanda-2.5.1.new.amindexd/common-src/packet.c
--- amanda-2.5.1.new/common-src/packet.c        2006-05-25 06:44:35.000000000 
-0400
+++ amanda-2.5.1.new.amindexd/common-src/packet.c       2006-09-21 
14:26:08.000000000 -0400
@@ -54,6 +54,7 @@ printf_arglist_function2(void pkt_init, 
     const char *, fmt)
 {
     va_list    argp;
+    int         len;
 
     assert(pkt != NULL);
     assert(strcmp(pkt_type2str(type), "BOGUS") != 0);
@@ -62,14 +63,16 @@ printf_arglist_function2(void pkt_init, 
     pkt->type = type;
     pkt->packet_size = 1000;
     pkt->body = alloc(pkt->packet_size);
-    arglist_start(argp, fmt);
-    while (vsnprintf(pkt->body, pkt->packet_size, fmt, argp) >=
-               (int)(pkt->packet_size - 1)) {
+    while(1) {
+       arglist_start(argp, fmt);
+       len = vsnprintf(pkt->body, pkt->packet_size, fmt, argp);
+       arglist_end(argp);
+       if (len < (int)(pkt->packet_size - 1))
+           break;
        pkt->packet_size *= 2;
        amfree(pkt->body);
        pkt->body = alloc(pkt->packet_size);
     }
-    arglist_end(argp);
     pkt->size = strlen(pkt->body);
 }
 
@@ -79,6 +82,7 @@ printf_arglist_function2(void pkt_init, 
 printf_arglist_function1(void pkt_cat, pkt_t *, pkt, const char *, fmt)
 {
     size_t     len;
+    int         lenX;
     va_list    argp;
     char *     pktbody;
 
@@ -87,19 +91,19 @@ printf_arglist_function1(void pkt_cat, p
 
     len = strlen(pkt->body);
 
-    arglist_start(argp, fmt);
-    while (vsnprintf(pkt->body + len, pkt->packet_size - len, fmt,argp) >=
-               (int)(pkt->packet_size - len - 1)) {
+    while(1) {
+       arglist_start(argp, fmt);
+        lenX = vsnprintf(pkt->body + len, pkt->packet_size - len, fmt,argp);
+       arglist_end(argp);
+       if (lenX < (int)(pkt->packet_size - len - 1))
+           break;
        pkt->packet_size *= 2;
        pktbody = alloc(pkt->packet_size);
        strncpy(pktbody, pkt->body, len);
        pktbody[len] = '\0';
        amfree(pkt->body);
        pkt->body = pktbody;
-       arglist_end(argp);
-       arglist_start(argp, fmt);
     }
-    arglist_end(argp);
     pkt->size = strlen(pkt->body);
 }
 
diff -u -r --show-c-function --exclude-from=amanda.diff 
amanda-2.5.1.new/server-src/amindexd.c 
amanda-2.5.1.new.amindexd/server-src/amindexd.c
--- amanda-2.5.1.new/server-src/amindexd.c      2006-07-25 14:27:57.000000000 
-0400
+++ amanda-2.5.1.new.amindexd/server-src/amindexd.c     2006-09-21 
13:47:19.000000000 -0400
@@ -295,7 +295,7 @@ printf_arglist_function1(static void rep
        len = vsnprintf(reply_buffer, reply_buffer_size, fmt, args);
        arglist_end(args);
 
-       if (len > -1 && (size_t)len < reply_buffer_size)
+       if (len > -1 && (size_t)len < reply_buffer_size-1)
            break;
 
        reply_buffer_size *= 2;
@@ -334,7 +334,7 @@ printf_arglist_function1(static void lre
        len = vsnprintf(reply_buffer, reply_buffer_size, fmt, args);
        arglist_end(args);
 
-       if (len > -1 && (size_t)len < reply_buffer_size)
+       if (len > -1 && (size_t)len < reply_buffer_size-1)
            break;
 
        reply_buffer_size *= 2;
@@ -375,7 +375,7 @@ printf_arglist_function1(static void fas
        len = vsnprintf(reply_buffer, reply_buffer_size, fmt, args);
        arglist_end(args);
 
-       if (len > -1 && (size_t)len < reply_buffer_size)
+       if (len > -1 && (size_t)len < reply_buffer_size-1)
            break;
 
        reply_buffer_size *= 2;
diff -u -r --show-c-function --exclude-from=amanda.diff 
amanda-2.5.1.new/server-src/logfile.c 
amanda-2.5.1.new.amindexd/server-src/logfile.c
--- amanda-2.5.1.new/server-src/logfile.c       2006-06-01 10:54:39.000000000 
-0400
+++ amanda-2.5.1.new.amindexd/server-src/logfile.c      2006-09-21 
14:30:56.000000000 -0400
@@ -104,6 +104,7 @@ printf_arglist_function2(char *log_genst
     arglist_start(argp, format);
     vsnprintf(linebuf, SIZEOF(linebuf)-1, format, argp);
                                                /* -1 to allow for '\n' */
+    arglist_end(argp);
     return(vstralloc(leader, linebuf, "\n", NULL));
 }
 
<Prev in Thread] Current Thread [Next in Thread>