+ /* Check or create dbpath */
+ int dbdirfd = open(dbpath, O_RDONLY);
+ if (dbdirfd == -1 && errno == ENOENT) {
+ if (errno == ENOENT) {
+ if ((mkdir(dbpath, 0755)) != 0) {
+ dbd_log( LOGSTD, "Can't create .AppleDB for \"%s\": %s", dbpath, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ dbd_log( LOGSTD, "Somethings wrong with .AppleDB for \"%s\", giving up: %s", dbpath, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ close(dbdirfd);
+ }
+