mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
clitar: use modern DBG macros
Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Jan 14 20:42:10 UTC 2020 on sn-devel-184
This commit is contained in:
parent
199f44ff87
commit
d512b27563
@ -306,15 +306,15 @@ int cmd_tarmode(void)
|
||||
}
|
||||
|
||||
if (i == ARRAY_SIZE(table))
|
||||
DBG(0, ("tarmode: unrecognised option %s\n", buf));
|
||||
d_printf("tarmode: unrecognised option %s\n", buf);
|
||||
}
|
||||
|
||||
DBG(0, ("tarmode is now %s, %s, %s, %s, %s\n",
|
||||
d_printf("tarmode is now %s, %s, %s, %s, %s\n",
|
||||
tar_ctx.mode.incremental ? "incremental" : "full",
|
||||
tar_ctx.mode.system ? "system" : "nosystem",
|
||||
tar_ctx.mode.hidden ? "hidden" : "nohidden",
|
||||
tar_ctx.mode.reset ? "reset" : "noreset",
|
||||
tar_ctx.mode.verbose ? "verbose" : "noverbose"));
|
||||
tar_ctx.mode.verbose ? "verbose" : "noverbose");
|
||||
|
||||
talloc_free(ctx);
|
||||
return 0;
|
||||
@ -361,14 +361,14 @@ int cmd_tar(void)
|
||||
|
||||
rc = tar_parse_args(&tar_ctx, flag, val, i);
|
||||
if (rc != 0) {
|
||||
DBG(0, ("parse_args failed\n"));
|
||||
d_printf("parse_args failed\n");
|
||||
err = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = tar_process(&tar_ctx);
|
||||
if (rc != 0) {
|
||||
DBG(0, ("tar_process failed\n"));
|
||||
d_printf("tar_process failed\n");
|
||||
err = 1;
|
||||
goto out;
|
||||
}
|
||||
@ -417,7 +417,7 @@ int tar_parse_args(struct tar* t,
|
||||
int rc;
|
||||
|
||||
if (t == NULL) {
|
||||
DBG(0, ("Invalid tar context\n"));
|
||||
DBG_WARNING("Invalid tar context\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -440,14 +440,14 @@ int tar_parse_args(struct tar* t,
|
||||
/* operation */
|
||||
case 'c':
|
||||
if (t->mode.operation != TAR_NO_OPERATION) {
|
||||
printf("Tar must be followed by only one of c or x.\n");
|
||||
d_printf("Tar must be followed by only one of c or x.\n");
|
||||
return 1;
|
||||
}
|
||||
t->mode.operation = TAR_CREATE;
|
||||
break;
|
||||
case 'x':
|
||||
if (t->mode.operation != TAR_NO_OPERATION) {
|
||||
printf("Tar must be followed by only one of c or x.\n");
|
||||
d_printf("Tar must be followed by only one of c or x.\n");
|
||||
return 1;
|
||||
}
|
||||
t->mode.operation = TAR_EXTRACT;
|
||||
@ -456,21 +456,21 @@ int tar_parse_args(struct tar* t,
|
||||
/* selection */
|
||||
case 'I':
|
||||
if (t->mode.selection != TAR_NO_SELECTION) {
|
||||
DBG(0,("Only one of I,X,F must be specified\n"));
|
||||
d_printf("Only one of I,X,F must be specified\n");
|
||||
return 1;
|
||||
}
|
||||
t->mode.selection = TAR_INCLUDE;
|
||||
break;
|
||||
case 'X':
|
||||
if (t->mode.selection != TAR_NO_SELECTION) {
|
||||
DBG(0,("Only one of I,X,F must be specified\n"));
|
||||
d_printf("Only one of I,X,F must be specified\n");
|
||||
return 1;
|
||||
}
|
||||
t->mode.selection = TAR_EXCLUDE;
|
||||
break;
|
||||
case 'F':
|
||||
if (t->mode.selection != TAR_NO_SELECTION) {
|
||||
DBG(0,("Only one of I,X,F must be specified\n"));
|
||||
d_printf("Only one of I,X,F must be specified\n");
|
||||
return 1;
|
||||
}
|
||||
t->mode.selection = TAR_INCLUDE;
|
||||
@ -480,12 +480,12 @@ int tar_parse_args(struct tar* t,
|
||||
/* blocksize */
|
||||
case 'b':
|
||||
if (ival >= valsize) {
|
||||
DBG(0, ("Option b must be followed by a blocksize\n"));
|
||||
d_printf("Option b must be followed by a blocksize\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (tar_set_blocksize(t, atoi(val[ival]))) {
|
||||
DBG(0, ("Option b must be followed by a valid blocksize\n"));
|
||||
d_printf("Option b must be followed by a valid blocksize\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -500,12 +500,12 @@ int tar_parse_args(struct tar* t,
|
||||
/* newer than */
|
||||
case 'N':
|
||||
if (ival >= valsize) {
|
||||
DBG(0, ("Option N must be followed by valid file name\n"));
|
||||
d_printf("Option N must be followed by valid file name\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (tar_set_newer_than(t, val[ival])) {
|
||||
DBG(0,("Error setting newer-than time\n"));
|
||||
d_printf("Error setting newer-than time\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -530,16 +530,16 @@ int tar_parse_args(struct tar* t,
|
||||
/* dry run mode */
|
||||
case 'n':
|
||||
if (t->mode.operation != TAR_CREATE) {
|
||||
DBG(0, ("n is only meaningful when creating a tar-file\n"));
|
||||
d_printf("n is only meaningful when creating a tar-file\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
t->mode.dry = true;
|
||||
DBG(0, ("dry_run set\n"));
|
||||
d_printf("dry_run set\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
DBG(0,("Unknown tar option\n"));
|
||||
d_printf("Unknown tar option\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -552,7 +552,7 @@ int tar_parse_args(struct tar* t,
|
||||
}
|
||||
|
||||
if (valsize - ival < 1) {
|
||||
DBG(0, ("No tar file given.\n"));
|
||||
d_printf("No tar file given.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -576,7 +576,7 @@ int tar_parse_args(struct tar* t,
|
||||
/* flag F -> read file list */
|
||||
if (do_read_list) {
|
||||
if (valsize - ival != 1) {
|
||||
DBG(0,("Option F must be followed by exactly one filename.\n"));
|
||||
d_printf("Option F must be followed by exactly one filename.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -612,7 +612,7 @@ int tar_process(struct tar *t)
|
||||
int rc = 0;
|
||||
|
||||
if (t == NULL) {
|
||||
DBG(0, ("Invalid tar context\n"));
|
||||
DBG_WARNING("Invalid tar context\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -624,7 +624,7 @@ int tar_process(struct tar *t)
|
||||
rc = tar_create(t);
|
||||
break;
|
||||
default:
|
||||
DBG(0, ("Invalid tar state\n"));
|
||||
DBG_WARNING("Invalid tar state\n");
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
@ -659,7 +659,7 @@ static int tar_create(struct tar* t)
|
||||
const int bsize = t->mode.blocksize * TAR_BLOCK_UNIT;
|
||||
r = archive_write_set_bytes_per_block(t->archive, bsize);
|
||||
if (r != ARCHIVE_OK) {
|
||||
DBG(0, ("Can't use a block size of %d bytes", bsize));
|
||||
d_printf("Can't use a block size of %d bytes", bsize);
|
||||
err = 1;
|
||||
goto out;
|
||||
}
|
||||
@ -671,8 +671,8 @@ static int tar_create(struct tar* t)
|
||||
*/
|
||||
r = archive_write_set_format_pax_restricted(t->archive);
|
||||
if (r != ARCHIVE_OK) {
|
||||
DBG(0, ("Can't use pax restricted format: %s\n",
|
||||
archive_error_string(t->archive)));
|
||||
d_printf("Can't use pax restricted format: %s\n",
|
||||
archive_error_string(t->archive));
|
||||
err = 1;
|
||||
goto out;
|
||||
}
|
||||
@ -684,8 +684,8 @@ static int tar_create(struct tar* t)
|
||||
}
|
||||
|
||||
if (r != ARCHIVE_OK) {
|
||||
DBG(0, ("Can't open %s: %s\n", t->tar_path,
|
||||
archive_error_string(t->archive)));
|
||||
d_printf("Can't open %s: %s\n", t->tar_path,
|
||||
archive_error_string(t->archive));
|
||||
err = 1;
|
||||
goto out_close;
|
||||
}
|
||||
@ -731,7 +731,7 @@ out_close:
|
||||
if (!t->mode.dry) {
|
||||
r = archive_write_close(t->archive);
|
||||
if (r != ARCHIVE_OK) {
|
||||
DBG(0, ("Fatal: %s\n", archive_error_string(t->archive)));
|
||||
d_printf("Fatal: %s\n", archive_error_string(t->archive));
|
||||
err = 1;
|
||||
goto out;
|
||||
}
|
||||
@ -982,7 +982,7 @@ static int tar_get_file(struct tar *t,
|
||||
* signed size. Very unlikely problem (>9 exabyte file)
|
||||
*/
|
||||
if (finfo->size > INT64_MAX) {
|
||||
DBG(0, ("Remote file %s too big\n", full_dos_path));
|
||||
d_printf("Remote file %s too big\n", full_dos_path);
|
||||
goto out_entry;
|
||||
}
|
||||
|
||||
@ -992,7 +992,7 @@ static int tar_get_file(struct tar *t,
|
||||
/* It's a directory just write a header */
|
||||
r = archive_write_header(t->archive, entry);
|
||||
if (r != ARCHIVE_OK) {
|
||||
DBG(0, ("Fatal: %s\n", archive_error_string(t->archive)));
|
||||
d_printf("Fatal: %s\n", archive_error_string(t->archive));
|
||||
err = 1;
|
||||
}
|
||||
if (t->mode.verbose) {
|
||||
@ -1012,7 +1012,7 @@ static int tar_get_file(struct tar *t,
|
||||
/* don't make tar file entry until after the file is open */
|
||||
r = archive_write_header(t->archive, entry);
|
||||
if (r != ARCHIVE_OK) {
|
||||
DBG(0, ("Fatal: %s\n", archive_error_string(t->archive)));
|
||||
d_printf("Fatal: %s\n", archive_error_string(t->archive));
|
||||
err = 1;
|
||||
goto out_entry;
|
||||
}
|
||||
@ -1024,8 +1024,8 @@ static int tar_get_file(struct tar *t,
|
||||
do {
|
||||
status = cli_read(cli, remote_fd, buf, off, sizeof(buf), &len);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG(0,("Error reading file %s : %s\n",
|
||||
full_dos_path, nt_errstr(status)));
|
||||
d_printf("Error reading file %s : %s\n",
|
||||
full_dos_path, nt_errstr(status));
|
||||
err = 1;
|
||||
goto out_close;
|
||||
}
|
||||
@ -1034,7 +1034,7 @@ static int tar_get_file(struct tar *t,
|
||||
|
||||
r = archive_write_data(t->archive, buf, len);
|
||||
if (r < 0) {
|
||||
DBG(0, ("Fatal: %s\n", archive_error_string(t->archive)));
|
||||
d_printf("Fatal: %s\n", archive_error_string(t->archive));
|
||||
err = 1;
|
||||
goto out_close;
|
||||
}
|
||||
@ -1077,8 +1077,8 @@ static int tar_extract(struct tar *t)
|
||||
}
|
||||
|
||||
if (r != ARCHIVE_OK) {
|
||||
DBG(0, ("Can't open %s : %s\n", t->tar_path,
|
||||
archive_error_string(t->archive)));
|
||||
d_printf("Can't open %s : %s\n", t->tar_path,
|
||||
archive_error_string(t->archive));
|
||||
err = 1;
|
||||
goto out;
|
||||
}
|
||||
@ -1091,10 +1091,10 @@ static int tar_extract(struct tar *t)
|
||||
break;
|
||||
}
|
||||
if (r == ARCHIVE_WARN) {
|
||||
DBG(0, ("Warning: %s\n", archive_error_string(t->archive)));
|
||||
d_printf("Warning: %s\n", archive_error_string(t->archive));
|
||||
}
|
||||
if (r == ARCHIVE_FATAL) {
|
||||
DBG(0, ("Fatal: %s\n", archive_error_string(t->archive)));
|
||||
d_printf("Fatal: %s\n", archive_error_string(t->archive));
|
||||
err = 1;
|
||||
goto out;
|
||||
}
|
||||
@ -1128,8 +1128,8 @@ out:
|
||||
r = archive_read_finish(t->archive);
|
||||
#endif
|
||||
if (r != ARCHIVE_OK) {
|
||||
DBG(0, ("Can't close %s : %s\n", t->tar_path,
|
||||
archive_error_string(t->archive)));
|
||||
d_printf("Can't close %s : %s\n", t->tar_path,
|
||||
archive_error_string(t->archive));
|
||||
err = 1;
|
||||
}
|
||||
return err;
|
||||
@ -1182,7 +1182,7 @@ static int tar_send_file(struct tar *t, struct archive_entry *entry)
|
||||
}
|
||||
|
||||
if (mode != AE_IFREG && mode != AE_IFDIR) {
|
||||
DBG(0, ("Skipping non-dir & non-regular file %s\n", full_path));
|
||||
d_printf("Skipping non-dir & non-regular file %s\n", full_path);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1198,8 +1198,8 @@ static int tar_send_file(struct tar *t, struct archive_entry *entry)
|
||||
|
||||
status = cli_open(cli, full_path, flags, DENY_NONE, &remote_fd);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG(0, ("Error opening remote file %s: %s\n",
|
||||
full_path, nt_errstr(status)));
|
||||
d_printf("Error opening remote file %s: %s\n",
|
||||
full_path, nt_errstr(status));
|
||||
err = 1;
|
||||
goto out;
|
||||
}
|
||||
@ -1215,18 +1215,18 @@ static int tar_send_file(struct tar *t, struct archive_entry *entry)
|
||||
break;
|
||||
}
|
||||
if (r == ARCHIVE_WARN) {
|
||||
DBG(0, ("Warning: %s\n", archive_error_string(t->archive)));
|
||||
d_printf("Warning: %s\n", archive_error_string(t->archive));
|
||||
}
|
||||
if (r == ARCHIVE_FATAL) {
|
||||
DBG(0, ("Fatal: %s\n", archive_error_string(t->archive)));
|
||||
d_printf("Fatal: %s\n", archive_error_string(t->archive));
|
||||
err = 1;
|
||||
goto close_out;
|
||||
}
|
||||
|
||||
status = cli_writeall(cli, remote_fd, 0, buf, off, len, NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG(0, ("Error writing remote file %s: %s\n",
|
||||
full_path, nt_errstr(status)));
|
||||
d_printf("Error writing remote file %s: %s\n",
|
||||
full_path, nt_errstr(status));
|
||||
err = 1;
|
||||
goto close_out;
|
||||
}
|
||||
@ -1235,8 +1235,8 @@ static int tar_send_file(struct tar *t, struct archive_entry *entry)
|
||||
close_out:
|
||||
status = cli_close(cli, remote_fd);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG(0, ("Error losing remote file %s: %s\n",
|
||||
full_path, nt_errstr(status)));
|
||||
d_printf("Error closing remote file %s: %s\n",
|
||||
full_path, nt_errstr(status));
|
||||
err = 1;
|
||||
}
|
||||
|
||||
@ -1306,7 +1306,7 @@ static int tar_set_newer_than(struct tar *t, const char *filename)
|
||||
|
||||
rc = sys_stat(filename, &stbuf, false);
|
||||
if (rc != 0) {
|
||||
DBG(0, ("Error setting newer-than time\n"));
|
||||
d_printf("Error setting newer-than time\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1333,7 +1333,7 @@ static int tar_read_inclusion_file(struct tar *t, const char* filename)
|
||||
|
||||
fd = open(filename, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
DBG(0, ("Can't open inclusion file '%s': %s\n", filename, strerror(errno)));
|
||||
d_printf("Can't open inclusion file '%s': %s\n", filename, strerror(errno));
|
||||
err = 1;
|
||||
goto out;
|
||||
}
|
||||
@ -1526,7 +1526,7 @@ static NTSTATUS tar_create_skip_path(struct tar *t,
|
||||
bool tar_to_process(struct tar *t)
|
||||
{
|
||||
if (t == NULL) {
|
||||
DBG(0, ("Invalid tar context\n"));
|
||||
DBG_WARNING("Invalid tar context\n");
|
||||
return false;
|
||||
}
|
||||
return t->to_process;
|
||||
@ -1673,7 +1673,7 @@ static int make_remote_path(const char *full_path)
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
status = cli_mkdir(cli, subpath);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DBG(0, ("Can't mkdir %s: %s\n", subpath, nt_errstr(status)));
|
||||
d_printf("Can't mkdir %s: %s\n", subpath, nt_errstr(status));
|
||||
err = 1;
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user