-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
removed segmentation faults, corrected commands and output need to fix o... #513
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,13 +48,18 @@ string WiredNetwork::networkStatus(string wiredNetworkName) | |
string line, res, result; | ||
size_t pos; | ||
|
||
line = Utils::exec(string("ifconfig -a")); //netstat | ||
pos = line.find("inet addr"); | ||
result = line.substr (pos); | ||
res = result.substr (10,27); | ||
|
||
return string(res); | ||
|
||
line = Utils::exec(string("iwconfig 2>&1")); //cat proc/load | ||
pos = line.find("ESSID"); | ||
if(pos < line.size()) | ||
{ | ||
result = line.substr(pos); | ||
res = result.substr(6,10); | ||
return string(res); | ||
} | ||
else | ||
{ | ||
return "No ssid found"; | ||
} | ||
// return "networkStatus"; | ||
} | ||
|
||
|
@@ -66,7 +71,7 @@ size_t pos; | |
line = Utils::exec(string("ifconfig -a")); | ||
pos = line.find("inet addr"); | ||
result = line.substr (pos); | ||
res = result.substr (10,27); | ||
res = result.substr (10,15); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How are you so sure that the pos is positive (not -1 to indicate that this was not found), and that the result is at least 25 characters long. This will definitely through exceptions if no network info is available... |
||
|
||
return string(res); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, the API should respond false if the property is not supported. I have opened the jira issue http://jira.webinos.org/browse/WP-916