X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fmsdos%2Fnamei.c;h=626a367bcd81145cb6dd4385b098755b58bf2f38;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=5b76ccd19e3fc25489af2d3ebc1addb587994c96;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c index 5b76ccd19..626a367bc 100644 --- a/fs/msdos/namei.c +++ b/fs/msdos/namei.c @@ -12,6 +12,14 @@ #include #include +/* MS-DOS "device special files" */ +static const unsigned char *reserved_names[] = { + "CON ", "PRN ", "NUL ", "AUX ", + "LPT1 ", "LPT2 ", "LPT3 ", "LPT4 ", + "COM1 ", "COM2 ", "COM3 ", "COM4 ", + NULL +}; + /* Characters that are undesirable in an MS-DOS file name */ static unsigned char bad_chars[] = "*?<>|\""; static unsigned char bad_if_strict_pc[] = "+=,; "; @@ -32,6 +40,7 @@ static int msdos_format_name(const unsigned char *name, int len, */ { unsigned char *walk; + const unsigned char **reserved; unsigned char c; int space; @@ -118,7 +127,11 @@ static int msdos_format_name(const unsigned char *name, int len, } while (walk - res < MSDOS_NAME) *walk++ = ' '; - + if (!opts->atari) + /* GEMDOS is less stupid and has no reserved names */ + for (reserved = reserved_names; *reserved; reserved++) + if (!strncmp(res, *reserved, 8)) + return -EINVAL; return 0; }