- int i;
-
- for (i = 0 ; i < 3 ; i++) {
- int fd;
- if ((mapmode[modenum] & O_CREAT) &&
- mapdir[modenum])
- /* Attempt to create directory, don't worry about
- * failure.
- */
- mkdir(mapdir[modenum], 0755);
- fd = open(mapname[i][modenum], mapmode[modenum], 0600);
- if (fd >= 0) {
- *choice = i;
- return fdopen(fd, mapsmode[modenum]);
- }
- }
+ int fd;
+ if ((mapmode[modenum] & O_CREAT))
+ /* Attempt to create directory, don't worry about
+ * failure.
+ */
+ (void)mkdir(mapname[MAP_DIRNAME], 0755);
+ fd = open(mapname[modenum], mapmode[modenum], 0600);
+ if (fd >= 0)
+ return fdopen(fd, mapsmode[modenum]);