X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2Ftest_initfile.c;h=afd607391aba85f78b3febff105b6c52584aba95;hp=12dc0280ec65548a6c7f24f28f6946756ca17f85;hb=844ea3e96c657de0e887fd3ebce90d1dff7103ad;hpb=4be39dd3718d708ccff65b01a8f634e05b56f3c9 diff --git a/sources/test_initfile.c b/sources/test_initfile.c index 12dc028..afd6073 100644 --- a/sources/test_initfile.c +++ b/sources/test_initfile.c @@ -99,6 +99,10 @@ int main(int argc, char *argv[]) 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; @@ -107,8 +111,7 @@ int main(int argc, char *argv[]) * 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");