Messages in this thread Patch in this message | | | Date | Thu, 1 Oct 1998 21:43:51 -0700 (PDT) | From | John Kennedy <> | Subject | linux-2.1.123+/ENOTDIR weirdness |
| |
10/01/98 @ 09:43:12 PM (Thursday)
I seem to recall some discussion on here about some new changes that resulted in ENOTDIR being visible to client applications. Apparently I wasn't paying enough attention. It looks like tar with the --backup option triggers this nicely. A stat() of a directory with a '/' on the end of it seems to trigger it nicely.
Is this something that we should patch around in the long term or is it something that is going to get fixed in the kernel?
I made this patch against GNU tar-1.12 to work around it for now.
--- john =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= --- ./src/misc.c.OLD Thu Apr 24 07:41:50 1997 +++ ./src/misc.c Thu Oct 1 21:00:00 1998 @@ -405,19 +405,34 @@ maybe_backup_file (const char *path, int archive) { struct stat file_stat; + register int result; /* Check if we really need to backup the file. */ if (archive && _remdev (path)) return 1; - if (stat (path, &file_stat)) + if (result = stat (path, &file_stat)) { - if (errno == ENOENT) - return 1; - - ERROR ((0, errno, "%s", path)); - return 0; + switch( errno ) + { + case ENOENT: + return 1; + break; + case ENOTDIR: + if (*(path + strlen(path) -1) == '/') + { + *((char *) path + strlen(path) -1) = 0; + result = stat(path, &file_stat); + } + default: + if (result < 0) + { + ERROR ((0, errno, "%s", path)); + return 0; + } + break; + } } if (S_ISDIR (file_stat.st_mode)) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |