Skip to content

Commit ccf56ae

Browse files
committed
safety opening process info
1 parent 650e5b0 commit ccf56ae

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

util/processinfo_linux2.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ namespace mongo {
3838
sprintf( name , "/proc/%d/stat" , pid );
3939

4040
FILE * f = fopen( name , "r");
41-
41+
if ( ! f ){
42+
stringstream ss;
43+
ss << "couldn't open [" << name << "] " << errnoWithDescription();
44+
string s = ss.str();
45+
msgassertedNoTrace( s.c_str() );
46+
}
47+
4248
int found = fscanf(f,
4349
"%d %s %c "
4450
"%d %d %d %d %d "

0 commit comments

Comments
 (0)