Permalink
Browse files

Do not segfault if user at filesystem do not have a match at passwd.

  • Loading branch information...
1 parent 56ac0a6 commit 1978f3525c00c398be5120845d8132774b845f89 @davidmoreno committed Feb 22, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/onion/handlers/exportlocal.c
@@ -168,9 +168,9 @@ int onion_handler_export_local_directory(onion_handler_export_local_data *data,
pwd=getpwuid(st.st_uid);
if (S_ISDIR(st.st_mode))
- onion_response_printf(res, " ['%s/',%d,'%s','dir'],\n",fi->d_name, st.st_size, pwd->pw_name);
+ onion_response_printf(res, " ['%s/',%d,'%s','dir'],\n",fi->d_name, st.st_size, pwd ? pwd->pw_name : "???");
else
- onion_response_printf(res, " ['%s',%d,'%s','file'],\n",fi->d_name, st.st_size, pwd->pw_name);
+ onion_response_printf(res, " ['%s',%d,'%s','file'],\n",fi->d_name, st.st_size, pwd ? pwd->pw_name : "???");
}
onion_response_write0(res," [] ]\n</script>\n");

0 comments on commit 1978f35

Please sign in to comment.