MCPcopy Create free account
hub / github.com/apache/nuttx / verify_optiondir

Function verify_optiondir

tools/configure.c:488–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486}
487
488static bool verify_optiondir(const char *directory)
489{
490 struct stat buf;
491
492 if (stat(directory, &buf) < 0)
493 {
494 /* It may be okay if the directory does not exist */
495
496 /* It may be okay if the file does not exist */
497
498 int errcode = errno;
499 if (errcode == ENOENT)
500 {
501 debug("verify_optiondir: stat of %s failed: %s\n",
502 directory, strerror(errno));
503 return false;
504 }
505 else
506 {
507 fprintf(stderr, "ERROR: stat of %s failed: %s\n",
508 directory, strerror(errno));
509 exit(EXIT_FAILURE);
510 }
511 }
512
513 if (!S_ISDIR(buf.st_mode))
514 {
515 fprintf(stderr, "ERROR: %s exists but is not a directory\n",
516 directory);
517 exit(EXIT_FAILURE);
518 }
519
520 return true;
521}
522
523static bool verify_file(const char *path)
524{

Callers 3

parse_argsFunction · 0.85
check_configdirFunction · 0.85
verify_appdirFunction · 0.85

Calls 5

strerrorFunction · 0.85
fprintfFunction · 0.85
exitFunction · 0.85
statClass · 0.70
debugFunction · 0.70

Tested by

no test coverage detected