From 1beb363f6f5ee82807f5b3f42a137e33d633c23a Mon Sep 17 00:00:00 2001 From: Clara Daia Hilgenberg Daru <cdhd12@inf.ufpr.br> Date: Wed, 28 Sep 2016 09:23:19 -0300 Subject: [PATCH] Correct error message type --- src/linux/get_distro.cpp | 16 ++++++++-------- src/linux/get_macaddr.cpp | 2 +- src/linux/get_user_count.cpp | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/linux/get_distro.cpp b/src/linux/get_distro.cpp index 5932fd84..17abdf3b 100644 --- a/src/linux/get_distro.cpp +++ b/src/linux/get_distro.cpp @@ -62,7 +62,7 @@ std::string get_distro() { } } - throw "Release file empty or incomplete."; + throw std::string("Release file empty or incomplete."); // openSuSE } else if (open_file("/etc/os-release", release_file)) { @@ -102,7 +102,7 @@ std::string get_distro() { if (name.length()) return name; - throw "Release file empty or incomplete."; + throw std::string("Release file empty or incomplete."); } else if (open_file("/etc/novell-release", release_file)) { @@ -111,7 +111,7 @@ std::string get_distro() { if (line.length()) return line; - throw "Release file empty."; + throw std::string("Release file empty."); } else if (open_file("/etc/sles-release", release_file)) { @@ -120,7 +120,7 @@ std::string get_distro() { if (line.length()) return line; - throw "Release file empty."; + throw std::string("Release file empty."); // fedora } else if (open_file("/etc/redhat-release", release_file)) { @@ -130,7 +130,7 @@ std::string get_distro() { if (line.length()) return line; - throw "Release file empty."; + throw std::string("Release file empty."); // debian -- leave this at the end, otherwise debian-based distros // will find the debian_version file instead of the actual @@ -142,7 +142,7 @@ std::string get_distro() { if (line.length()) return line; - throw "Release file empty."; + throw std::string("Release file empty."); } else if (open_file("/etc/debian-version", release_file)) { @@ -151,9 +151,9 @@ std::string get_distro() { if (line.length()) return line; - throw "Release file empty."; + throw std::string("Release file empty."); } - throw "No release file found."; + throw std::string("No release file found."); } diff --git a/src/linux/get_macaddr.cpp b/src/linux/get_macaddr.cpp index 86275647..14a0f5fd 100644 --- a/src/linux/get_macaddr.cpp +++ b/src/linux/get_macaddr.cpp @@ -31,7 +31,7 @@ std::string get_macaddr() { if (!file.is_open()) { file.open("/sys/class/net/eth1/address", std::ifstream::in); if (!file.is_open()) { - throw "No address file found."; + throw std::string("No address file found."); } } diff --git a/src/linux/get_user_count.cpp b/src/linux/get_user_count.cpp index 33af3ca0..134a4981 100644 --- a/src/linux/get_user_count.cpp +++ b/src/linux/get_user_count.cpp @@ -432,7 +432,7 @@ static struct user_log * last_modified() { p = (struct utmplist *)malloc(sizeof(struct utmplist)); if (p == NULL) { - throw "ERROR: out of memory"; + throw std::string("ERROR: out of memory"); } memcpy(&p->ut, &ut, sizeof(struct utmp)); @@ -550,7 +550,7 @@ static struct user_log * last_modified() { break; p = (struct utmplist *)malloc(sizeof(struct utmplist)); if (p == NULL) { - throw "ERROR: out of memory"; + throw std::string("ERROR: out of memory"); } memcpy(&p->ut, &ut, sizeof(struct utmp)); p->next = utmplist; -- GitLab