Skip to content

Instantly share code, notes, and snippets.

@andrewg-felinemenace
Created April 1, 2012 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewg-felinemenace/2270551 to your computer and use it in GitHub Desktop.
Save andrewg-felinemenace/2270551 to your computer and use it in GitHub Desktop.
horrible :>
static int sanity_check_name(char *s)
{
char buf[256];
int error;
error = 0;
error |= (!! strstr(s, "ssh"));
error |= (!! strstr(s, "/."));
memset(buf, 0, sizeof(buf));
if((realpath(s, buf) == NULL) && errno != ENOENT) error |= 1;
error |= (buf[0] == '.');
return error;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment