Skip to content

Commit

Permalink
task-refs: remove unnecessary sscanf().
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanyao authored and Fengguang Wu committed Sep 7, 2018
1 parent 8d2005f commit 753c74d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ProcMaps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,12 @@ static int parse_proc_maps(pid_t pid, std::vector<proc_maps_entry>& maps)
sscanf(str_value[2].c_str(), "%lx", &e.offset);
sscanf(str_value[3].c_str(), "%d:%d", &e.dev_major, &e.dev_minor);
sscanf(str_value[4].c_str(), "%lu", &e.ino);
sscanf(str_value[5].c_str(), "%s", filename);


e.read = (str_value[1][0] == 'r');
e.write = (str_value[1][1] == 'w');
e.exec = (str_value[1][2] == 'x');
e.mayshare = (str_value[1][3] != 'p');
e.path = filename;
e.path = str_value[5];

maps.push_back(e);

Expand Down

0 comments on commit 753c74d

Please sign in to comment.