projects
/
debian
/
amanda
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'upstream/3.3.3'
[debian/amanda]
/
server-src
/
tapefile.c
diff --git
a/server-src/tapefile.c
b/server-src/tapefile.c
index b4212e5894238b47bc4d49e9801938ba26f4d78e..35cbef231c1619a5c7e8f90f6bba25650ec61ef1 100644
(file)
--- a/
server-src/tapefile.c
+++ b/
server-src/tapefile.c
@@
-1,6
+1,7
@@
/*
* Amanda, The Advanced Maryland Automatic Network Disk Archiver
* Copyright (c) 1991-1998 University of Maryland at College Park
/*
* Amanda, The Advanced Maryland Automatic Network Disk Archiver
* Copyright (c) 1991-1998 University of Maryland at College Park
+ * Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved.
* All Rights Reserved.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* All Rights Reserved.
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@
-50,7
+51,7
@@
read_tapelist(
char *line = NULL;
int status = 0;
char *line = NULL;
int status = 0;
-
tape_list = NULL
;
+
clear_tapelist()
;
if((tapef = fopen(tapefile,"r")) == NULL) {
if (errno == ENOENT) {
/* no tapelist is equivalent to an empty tapelist */
if((tapef = fopen(tapefile,"r")) == NULL) {
if (errno == ENOENT) {
/* no tapelist is equivalent to an empty tapelist */
@@
-106,6
+107,8
@@
write_tapelist(
g_fprintf(tapef, " BARCODE:%s", tp->barcode);
if (tp->meta)
g_fprintf(tapef, " META:%s", tp->meta);
g_fprintf(tapef, " BARCODE:%s", tp->barcode);
if (tp->meta)
g_fprintf(tapef, " META:%s", tp->meta);
+ if (tp->blocksize)
+ g_fprintf(tapef, " BLOCKSIZE:%jd", (intmax_t)tp->blocksize);
if (tp->comment)
g_fprintf(tapef, " #%s", tp->comment);
g_fprintf(tapef, "\n");
if (tp->comment)
g_fprintf(tapef, " #%s", tp->comment);
g_fprintf(tapef, "\n");
@@
-130,6
+133,9
@@
clear_tapelist(void)
for(tp = tape_list; tp; tp = next) {
amfree(tp->label);
amfree(tp->datestamp);
for(tp = tape_list; tp; tp = next) {
amfree(tp->label);
amfree(tp->datestamp);
+ amfree(tp->barcode);
+ amfree(tp->meta);
+ amfree(tp->comment);
next = tp->next;
amfree(tp);
}
next = tp->next;
amfree(tp);
}
@@
-273,6
+279,9
@@
remove_tapelabel(
}
amfree(tp->datestamp);
amfree(tp->label);
}
amfree(tp->datestamp);
amfree(tp->label);
+ amfree(tp->meta);
+ amfree(tp->comment);
+ amfree(tp->barcode);
amfree(tp);
}
}
amfree(tp);
}
}
@@
-287,7
+296,7
@@
add_tapelabel(
/* insert a new record to the front of the list */
/* insert a new record to the front of the list */
- new =
(tape_t *) alloc(SIZEOF(tape_t)
);
+ new =
g_new0(tape_t, 1
);
new->datestamp = stralloc(datestamp);
new->position = 0;
new->datestamp = stralloc(datestamp);
new->position = 0;
@@
-358,21
+367,21
@@
parse_tapeline(
tape_t *tp = NULL;
char *s, *s1;
int ch;
tape_t *tp = NULL;
char *s, *s1;
int ch;
+ char *cline;
*status = 0;
*status = 0;
- tp = (tape_t *) alloc(SIZEOF(tape_t));
-
- tp->prev = NULL;
- tp->next = NULL;
s = line;
ch = *s++;
skip_whitespace(s, ch);
if(ch == '\0') {
s = line;
ch = *s++;
skip_whitespace(s, ch);
if(ch == '\0') {
- amfree(tp);
return NULL;
}
return NULL;
}
+
+ cline = g_strdup(line);
+ tp = g_new0(tape_t, 1);
+
s1 = s - 1;
skip_non_whitespace(s, ch);
s[-1] = '\0';
s1 = s - 1;
skip_non_whitespace(s, ch);
s[-1] = '\0';
@@
-407,8
+416,6
@@
parse_tapeline(
s[-1] = '\0';
skip_whitespace(s, ch);
tp->barcode = stralloc(s1);
s[-1] = '\0';
skip_whitespace(s, ch);
tp->barcode = stralloc(s1);
- } else {
- tp->barcode = NULL;
}
if (strncmp_const(s - 1, "META:") == 0) {
}
if (strncmp_const(s - 1, "META:") == 0) {
@@
-417,14
+424,19
@@
parse_tapeline(
s[-1] = '\0';
skip_whitespace(s, ch);
tp->meta = stralloc(s1);
s[-1] = '\0';
skip_whitespace(s, ch);
tp->meta = stralloc(s1);
- } else {
- tp->meta = NULL;
}
}
+ if (strncmp_const(s - 1, "BLOCKSIZE:") == 0) {
+ s1 = s - 1 + 10;
+ skip_non_whitespace(s, ch);
+ s[-1] = '\0';
+ skip_whitespace(s, ch);
+ tp->blocksize = atol(s1);
+ }
if (*(s - 1) == '#') {
tp->comment = stralloc(s); /* skip leading '#' */
if (*(s - 1) == '#') {
tp->comment = stralloc(s); /* skip leading '#' */
- } else {
-
tp->comment = NULL
;
+ } else
if (*(s-1))
{
+
g_critical("Bogus line in the tapelist file: %s", cline)
;
}
return tp;
}
return tp;