I'd use strncmp, not strstr, as you only want to check if "pei-" appears at the *beginning* of the target name. Still not bulletproof, but better.