ftpfs: dont convert names to latin when string is valid utf-8

This commit is contained in:
cinap_lenrek 2014-08-02 14:37:16 +02:00
parent 7cc757c3c0
commit 7ae4e473da

View file

@ -1517,14 +1517,17 @@ fromlatin1(char *from)
{ {
char *p, *to; char *p, *to;
Rune r; Rune r;
int n;
if(os == Plan9) if(os == Plan9)
return nil; return nil;
/* don't convert if we don't have to */ /* don't convert if we don't have to */
for(p = from; *p; p++) for(p = from; *p; p += n){
if(*p & 0x80) n = chartorune(&r, p);
if(r == Runeerror)
break; break;
}
if(*p == 0) if(*p == 0)
return nil; return nil;