Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/msdosfs Fix for handling of 8+3 filenames with blanks su...
details: https://anonhg.NetBSD.org/src/rev/356cba0a00be
branches: trunk
changeset: 467734:356cba0a00be
user: tron <tron%NetBSD.org@localhost>
date: Sun Mar 28 11:05:43 1999 +0000
description:
Fix for handling of 8+3 filenames with blanks supplied by Bill Sommerfeld
in PR kern/7229.
diffstat:
sys/msdosfs/msdosfs_conv.c | 29 ++++++++++++++++++++---------
1 files changed, 20 insertions(+), 9 deletions(-)
diffs (74 lines):
diff -r 263182b903d5 -r 356cba0a00be sys/msdosfs/msdosfs_conv.c
--- a/sys/msdosfs/msdosfs_conv.c Sun Mar 28 10:35:05 1999 +0000
+++ b/sys/msdosfs/msdosfs_conv.c Sun Mar 28 11:05:43 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msdosfs_conv.c,v 1.26 1999/01/07 15:03:36 leo Exp $ */
+/* $NetBSD: msdosfs_conv.c,v 1.27 1999/03/28 11:05:43 tron Exp $ */
/*-
* Copyright (C) 1995, 1997 Wolfgang Solfrank.
@@ -357,7 +357,7 @@
u_char *un;
int lower;
{
- int i;
+ int i, j;
int thislong = 1;
u_char c;
@@ -372,18 +372,22 @@
else
c = dos2unix[*dn];
*un++ = lower ? u2l[c] : c;
- dn++;
/*
- * Copy the name portion into the unix filename string.
+ * Copy the rest into the unix filename string, ignoring
+ * trailing blanks.
*/
- for (i = 1; i < 8 && *dn != ' '; i++) {
- c = dos2unix[*dn++];
+
+ for (j=7; (j >= 0) && (dn[j] == ' '); j--)
+ ;
+
+ for (i = 1; i <= j; i++) {
+ c = dos2unix[dn[i]];
*un++ = lower ? u2l[c] : c;
thislong++;
}
- dn += 8 - i;
-
+ dn += 8;
+
/*
* Now, if there is an extension then put in a period and copy in
* the extension.
@@ -424,6 +428,7 @@
int conv = 1;
const u_char *cp, *dp, *dp1;
u_char gentext[6], *wcp;
+ int shortlen;
/*
* Fill the dos filename string with blanks. These are DOS's pad
@@ -503,11 +508,17 @@
dp++;
}
+ shortlen = (dp - un) <= 8;
+
/*
* Now convert the rest of the name
*/
for (i = j = 0; un < dp && j < 8; i++, j++, un++) {
- if (*un != (dn[j] = unix2dos[*un])
+ if ((*un == ' ') && shortlen)
+ dn[j] = ' ';
+ else
+ dn[j] = unix2dos[*un];
+ if ((*un != dn[j])
&& conv != 3)
conv = 2;
if (!dn[j]) {
Home |
Main Index |
Thread Index |
Old Index