// If lines 17 -21 and 25 to 30 are removed rrtest does not give error
if(-1 == f_d)
{
printf("\n NULL File descriptor\n");
return -1;
}
errno = 0;
// If lines 17 -21 and 25 to 30 are removed rrtest does not give error
if(fstat(f_d, &st))
{
printf("\nfstat error: [%s]\n",strerror(errno));
close(f_d);
return -1;
}
rename("snazzyjazz.txt", "test2.txt");
int x = 0 ;
x = 5 ;
rename("test2.txt", "test3.txt");
int y = 0 ;
y = 5 ;
rename("test3.txt", "test4.txt");
return 0;
}
`#include
include
include <sys/types.h>
include <sys/stat.h>
include
include
include
include
int main() { int f_d = 0; struct stat st;
// If lines 17 -21 and 25 to 30 are removed rrtest does not give error if(-1 == f_d) { printf("\n NULL File descriptor\n"); return -1; }
// If lines 17 -21 and 25 to 30 are removed rrtest does not give error if(fstat(f_d, &st)) { printf("\nfstat error: [%s]\n",strerror(errno)); close(f_d); return -1; }
rename("snazzyjazz.txt", "test2.txt"); int x = 0 ; x = 5 ; rename("test2.txt", "test3.txt"); int y = 0 ; y = 5 ; rename("test3.txt", "test4.txt"); return 0; }