From: Denis Vlasenko Date: Wed, 19 Mar 2008 23:25:00 +0000 (-0000) Subject: die_if_bad_username: shrink: 88 -> 77 bytes X-Git-Tag: 1_10_0~16 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=104d544fd740c9d583893a476935f0e7fd44345c;p=oweals%2Fbusybox.git die_if_bad_username: shrink: 88 -> 77 bytes --- diff --git a/libbb/die_if_bad_username.c b/libbb/die_if_bad_username.c index 251b1f06c..337ac6012 100644 --- a/libbb/die_if_bad_username.c +++ b/libbb/die_if_bad_username.c @@ -18,17 +18,19 @@ void die_if_bad_username(const char *name) { - int i = 0; - + goto skip; /* 1st char being dash isn't valid */ do { - if (!isalnum(*name) - && !(*name == '_') - && !(*name == '.') - && !(*name == '@') - && !(*name == '-' && i) - && !(*name == '$' && !*(name + 1)) - ) - bb_error_msg_and_die("illegal character '%c'", *name); - i++; + if (*name == '-') + continue; + skip: + if (isalnum(*name) + || *name == '_' + || *name == '.' + || *name == '@' + || (*name == '$' && !*(name + 1)) + ) { + continue; + } + bb_error_msg_and_die("illegal character '%c'", *name); } while (*++name); }