X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=common-src%2Ffileheader.c;h=32bce0d014412ab9642759390ffe3106b3faafbc;hb=cb115640695b55ed9c0a8dbeb414219b09438aa7;hp=60c8c16940bcf4407f399edbf213f4f1a51e1c06;hpb=d5853102f67d85d8e169f9dbe973ad573306c215;p=debian%2Famanda diff --git a/common-src/fileheader.c b/common-src/fileheader.c index 60c8c16..32bce0d 100644 --- a/common-src/fileheader.c +++ b/common-src/fileheader.c @@ -37,7 +37,6 @@ static const char * filetype2str(filetype_t); static filetype_t str2filetype(const char *); static void strange_header(dumpfile_t *, const char *, size_t, const char *, const char *); -static ssize_t hexdump(const char *buffer, size_t len); static char *quote_heredoc(char *text, char *delimiter_prefix); static char *parse_heredoc(char *line, char **saveptr); @@ -63,11 +62,8 @@ strange_header( if (expected == NULL) expected = ""; - g_fprintf(stderr, _("%s: strange amanda header: \"%.*s\"\n"), get_pname(), - (int)buflen, buffer); - - g_fprintf(stderr, _("%s: Expected: \"%s\" Actual: \"%s\"\n"), get_pname(), - expected, actual); + g_debug("strange amanda header: \"%.*s\"", (int)buflen, buffer); + g_debug("Expected: \"%s\" Actual: \"%s\"", expected, actual); file->type = F_WEIRD; } @@ -136,10 +132,7 @@ parse_file_header( tok = strtok_r(line1, " ", &saveptr); if (tok == NULL) { - g_fprintf(stderr, _("%s: Empty amanda header: buflen=%zu lsize=%zu\n"), get_pname(), - buflen, - lsize); - hexdump(buffer, lsize); + g_debug("Empty amanda header: buflen=%zu lsize=%zu", buflen, lsize); strange_header(file, buffer, buflen, _(""), tok); goto out; } @@ -234,6 +227,13 @@ parse_file_header( strange_header(file, buffer, buflen, _(""), tok); goto out; } + } else if (file->type == F_DUMPFILE) { + /* only one part in this dump, so call it partnum 1 */ + file->partnum = 1; + file->totalparts = 1; + } else { + file->partnum = 0; + file->totalparts = 0; } tok = strtok_r(NULL, " ", &saveptr); @@ -756,12 +756,10 @@ build_header(const dumpfile_t * file, size_t *size, size_t max_size) g_string_append_printf(rval, "\n"); if (file->cont_filename[0] != '\0') { - validate_no_space(file->cont_filename, "cont_filename"); g_string_append_printf(rval, "CONT_FILENAME=%s\n", file->cont_filename); } if (file->application[0] != '\0') { - validate_no_space(file->application, "application"); g_string_append_printf(rval, "APPLICATION=%s\n", file->application); } if (file->is_partial != 0) { @@ -1051,25 +1049,6 @@ void dumpfile_free(dumpfile_t* info) { amfree(info); } -static ssize_t -hexdump( - const char *buffer, - size_t len) -{ - ssize_t rc = -1; - - FILE *stream = popen("od -c -x -", "w"); - - if (stream != NULL) { - fflush(stdout); - rc = (ssize_t)fwrite(buffer, len, 1, stream); - if (ferror(stream)) - rc = -1; - pclose(stream); - } - return rc; -} - static char *quote_heredoc( char *text, char *delimiter_prefix)