|
From: | bagavathy.raja |
Subject: | [Bug-tar] Reg tar corrupting stdout |
Date: | Mon, 16 Oct 2006 23:31:12 +0530 |
I downloaded tar-1.15.1 version.I am facing some issues while having this code into my sample program .
Can you please go through this mail and help me out of this.
I tried to include tar functionality in my sample program by having tar library dynamically linked.
I renamed main function which is in tar.c into tarMain and called tarMain() with my own argc,argv filled.
My sample code looks like this .
int main()
{
int argc ;
char **argv;
argc = 4;
argv[0] = "./tar" ;
argv[1] = "-cvf" ;
argv[2] = "sample.tar" ;
Argv[3] = "sample.txt" ;
tarMain(argc,argv);
printf("after tar main");
return 0 ;
}
But I found that stdout was corrupted after calling tarMain in my code .because printf is not printing any thing in console.
Looks like you are already aware of this problem because you have a check for this like below one in tar.c .
if (stdlis != stderr && (ferror (stdlis) || fclose (stdlis) != 0))
FATAL_ERROR ((0, 0, _("Error in writing to standard output")));
I tried by commenting FATAL_ERROR and had simple "return 0" instead; The thing is if fclose is not called after archiving , stdout is fine.
Can you please let me know if it is a bug . If it is , how to avoid this.Is there any patch ?
I would be grateful to you if this things are clarified to me.
Regards
Bagavathy
[Prev in Thread] | Current Thread | [Next in Thread] |