Skip to content

Commit 42dfc44

Browse files
Merge pull request diffblue#175 from diffblue/bugfix/handle-ecryptfs
Handle eCryptfs
2 parents 816e792 + 3025672 commit 42dfc44

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/summaries/summary_dump.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -886,12 +886,15 @@ bool skip_fn_summary(const std::string &fname)
886886
}
887887

888888

889-
std::string to_file_name(std::string result)
889+
std::string to_file_name(std::string file_name, std::size_t suffix_length)
890890
{
891-
result = make_valid_filename(result);
892-
if(result.size()>240)
893-
result.resize(240); // Leave a reasonable amount of space for a suffix
894-
return result;
891+
// The maximum file name length is 255 on most Linux file systems
892+
// but 140 if using eCryptfs
893+
std::size_t max_file_name_length=140-suffix_length;
894+
file_name = make_valid_filename(file_name);
895+
if(file_name.size()>max_file_name_length)
896+
file_name.resize(max_file_name_length);
897+
return file_name;
895898
}
896899

897900
std::string to_html_text(std::string result)

src/summaries/summary_dump.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void dump_instruction_code_in_html(
100100
std::ostream &ostr
101101
);
102102

103-
std::string to_file_name(std::string result);
103+
std::string to_file_name(std::string file_name, std::size_t suffix_length=15);
104104
bool skip_fn_summary(const std::string &fname);
105105

106106

0 commit comments

Comments
 (0)