mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-20 06:56:28 -05:00
Fix quoting in Linux
We cannot quote UTF-8 chars.
This commit is contained in:
parent
1f76216697
commit
1681f7c9c7
2 changed files with 30 additions and 26 deletions
3
HISTORY
3
HISTORY
|
|
@ -1,8 +1,9 @@
|
|||
SnapRAID HISTORY
|
||||
================
|
||||
|
||||
11.1 2017/01
|
||||
11.1 2017/02
|
||||
============
|
||||
* Fixed quoting when printing in Linux. This fixes the UTF-8 output.
|
||||
* Fixed recognition of 'hashsize' in the configuration file.
|
||||
The previous incorrect 'hash_size' is still supported for backward
|
||||
compatibility.
|
||||
|
|
|
|||
|
|
@ -527,32 +527,29 @@ const char* esc_shell_multi(const char** str_map, unsigned str_max, char* buffer
|
|||
*p++ = c;
|
||||
}
|
||||
break;
|
||||
default :
|
||||
/* unquoted */
|
||||
if (p == end)
|
||||
goto bail;
|
||||
*p++ = c;
|
||||
break;
|
||||
#else
|
||||
case 'a' ... 'z' :
|
||||
case 'A' ... 'Z' :
|
||||
case '0' ... '9' :
|
||||
case ',' :
|
||||
case '.' :
|
||||
case '_' :
|
||||
case '+' :
|
||||
case ':' :
|
||||
case '@' :
|
||||
case '%' :
|
||||
case '/' :
|
||||
case '-' :
|
||||
/* safe chars for all shells, unquoted */
|
||||
if (p == end)
|
||||
goto bail;
|
||||
*p++ = c;
|
||||
break;
|
||||
default :
|
||||
/* all the others are quoted with \ */
|
||||
/* special chars that need to be quoted */
|
||||
case ' ' : /* space */
|
||||
case '~' : /* home */
|
||||
case '`' : /* command */
|
||||
case '#' : /* comment */
|
||||
case '$' : /* variable */
|
||||
case '&' : /* background job */
|
||||
case '*' : /* wildcard */
|
||||
case '(' : /* shell */
|
||||
case ')' : /* shell */
|
||||
case '\\': /* quote */
|
||||
case '|' : /* pipe */
|
||||
case '[' : /* wildcard */
|
||||
case ']' : /* wildcard */
|
||||
case '{' : /* code */
|
||||
case '}' : /* code */
|
||||
case ';' : /* separator */
|
||||
case '\'': /* quote */
|
||||
case '"' : /* quote */
|
||||
case '<' : /* redirect */
|
||||
case '>' : /* redirect */
|
||||
case '?' : /* wildcard */
|
||||
if (p == end)
|
||||
goto bail;
|
||||
*p++ = '\\';
|
||||
|
|
@ -561,6 +558,12 @@ const char* esc_shell_multi(const char** str_map, unsigned str_max, char* buffer
|
|||
*p++ = c;
|
||||
break;
|
||||
#endif
|
||||
default :
|
||||
/* unquoted */
|
||||
if (p == end)
|
||||
goto bail;
|
||||
*p++ = c;
|
||||
break;
|
||||
}
|
||||
|
||||
++str;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue