int newfd, res, count;
count = strlen(argv[optind+1]);
newfd = open(dir, O_PATH|O_RDWR);
+ if (newfd < 0) {
+ perror("Cannot open destination dir");
+ exit(1);
+ }
res = InitFile(newfd, file, argv[optind+1], count);
free(path);
return 0;
* routine to print usage info and exit
*/
void usage(void) {
- printf("Program test_initfile : test initfile \n");
- printf("Create a link to a tempfile or a link to -f indicated file");
+ printf("Program test_initfile : create a file with initial content \n");
printf("Usage:\n");
printf(" test_initfile [-h] pathname 'test to be written on pathname' \n");
printf(" -h print this help\n");