Skip to content

Instantly share code, notes, and snippets.

@garrettr
Last active May 10, 2016 21:39
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 garrettr/4e1f54fd5b9f20a365b400441a27b1d7 to your computer and use it in GitHub Desktop.
Save garrettr/4e1f54fd5b9f20a365b400441a27b1d7 to your computer and use it in GitHub Desktop.
C: What's wrong with this code?
static char* webfp_logfile_path = NULL;
static char*
get_logfile_path()
{
if (!webfp_logfile_path) {
char *home_path = getenv("HOME");
char* logfile_path = "/FingerprintSecureDrop/logging/tor_cell_seq.log";
int x = strlen(home_path) + strlen(logfile_path) + 1;
char abs_logfile_path[x];
strcpy(abs_logfile_path, home_path);
strcat(abs_logfile_path, logfile_path);
webfp_logfile_path = abs_logfile_path;
}
return webfp_logfile_path;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment