lintian doesn't like orphan packages with uploaders...
[debian/amanda] / amar-src / amar.c
index f6577d7d5ff35b911a086805544d802acc5e3362..76650a3779ba0126c47b0b74386a0fdf1c2c5520 100644 (file)
@@ -1,9 +1,10 @@
 /*
- * Copyright (c) 2008,2009 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2008-2012 Zmanda, Inc.  All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -902,6 +903,22 @@ amar_read(
                }
 
                if (!datasize) {
+                   unsigned int i, nul_padding = 1;
+                   char *bb;
+                   /* try to detect NULL padding bytes */
+                   if (!buf_atleast(archive, &hp, 512 - RECORD_SIZE)) {
+                       /* close to end of file */
+                       break;
+                   }
+                   bb = buf_ptr(&hp);
+                   /* check all byte == 0 */
+                   for (i=0; i<512 - RECORD_SIZE; i++) {
+                       if (*bb++ != 0)
+                           nul_padding = 0;
+                   }
+                   if (nul_padding) {
+                       break;
+                   }
                    g_set_error(error, amar_error_quark(), EINVAL,
                                "Archive file %d has an empty filename",
                                (int)filenum);