]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Avoid empty file name for the user's report file
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Fri, 9 Mar 2012 13:40:02 +0000 (14:40 +0100)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Fri, 9 Mar 2012 13:40:02 +0000 (14:40 +0100)
If an empty user name creeps up to the name manufacturing function, the name
generated to store the user's files is empty and it leads to the deletion of
the whole report directory during the process. The visible results is that sarg
ends up with an error because its output directory is missing.

This patch makes sure no empty file name is used. It is still necessary to
avoid empty user names in the first place.

userinfo.c

index ec22838ddedd7429a05f2a87afd561802ecdbfd5..9117a23614e6ae4f5b257742514049f1f7e5de0e 100644 (file)
@@ -107,6 +107,7 @@ struct userinfostruct *userinfo_create(const char *userid)
                                }
                        }
                }
+               if (j==0) user->filename[j++]='_'; //don't leave a file name empty
                user->filename[j]='\0';
                flen=i-1;