diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-05-27 00:55:03 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-05-27 00:55:03 -0400 |
commit | ccf56ae4c251f571a395d759f03a44d8bf5e40df (patch) | |
tree | fb388a4bb84c2c300ebf8180745b2d4e7e60793e | |
parent | 650e5b099fd9f56084954aec025b4acd458ce4af (diff) | |
download | mongo-ccf56ae4c251f571a395d759f03a44d8bf5e40df.tar.gz |
safety opening process info
-rw-r--r-- | util/processinfo_linux2.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/util/processinfo_linux2.cpp b/util/processinfo_linux2.cpp index eaaee0917a4..88adeb9bac8 100644 --- a/util/processinfo_linux2.cpp +++ b/util/processinfo_linux2.cpp @@ -38,7 +38,13 @@ namespace mongo { sprintf( name , "/proc/%d/stat" , pid ); FILE * f = fopen( name , "r"); - + if ( ! f ){ + stringstream ss; + ss << "couldn't open [" << name << "] " << errnoWithDescription(); + string s = ss.str(); + msgassertedNoTrace( s.c_str() ); + } + int found = fscanf(f, "%d %s %c " "%d %d %d %d %d " |