Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46bdc968 authored by Xuefer's avatar Xuefer Committed by Dees Troy
Browse files

remove useless memset and \n

fgets reads up to one byte less than size then with \0 at the end
adding \n after \0 is useless too

Change-Id: I7758d7a8f885bdde2b491a9cb75800f831d77c1f
parent 8335324d
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1366,7 +1366,6 @@ int GUIAction::terminalcommand(std::string arg)
					keep_going = 0;
				} else {
					// Try to read output
					memset(line, 0, sizeof(line));
					if(fgets(line, sizeof(line), fp) != NULL)
						gui_print("%s", line); // Display output
					else
+0 −3
Original line number Diff line number Diff line
@@ -64,10 +64,7 @@ int TWFunc::Exec_Cmd(const string& cmd, string &result) {
	exec = __popen(cmd.c_str(), "r");
	if (!exec) return -1;
	while(!feof(exec)) {
		memset(&buffer, 0, sizeof(buffer));
		if (fgets(buffer, 128, exec) != NULL) {
			buffer[128] = '\n';
			buffer[129] = 0;
			result += buffer;
		}
	}