1243 |
1243 |
1244 // check temp dir and fall back to $HOME |
1244 // check temp dir and fall back to $HOME |
1245 if(access(outfile, W_OK)) { |
1245 if(access(outfile, W_OK)) { |
1246 char* home = getenv("HOME"); |
1246 char* home = getenv("HOME"); |
1247 if(home) { |
1247 if(home) { |
1248 size_t len = strlen(envtmp); |
1248 size_t len = strlen(home); |
1249 outfile = malloc(len+24); |
1249 outfile = malloc(len+24); |
1250 memcpy(outfile, home, len+1); |
1250 memcpy(outfile, home, len+1); |
1251 if(outfile[len-1] != '/') { |
1251 if(outfile[len-1] != '/') { |
1252 outfile[len] = '/'; |
1252 outfile[len] = '/'; |
1253 outfile[len+1] = 0; |
1253 outfile[len+1] = 0; |