From 46bdc9681507e3a8484b2050a8f3ff8c229e890d Mon Sep 17 00:00:00 2001 From: Xuefer Date: Wed, 15 Apr 2015 19:49:45 +0800 Subject: 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 --- twrp-functions.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'twrp-functions.cpp') diff --git a/twrp-functions.cpp b/twrp-functions.cpp index 3bc879929..6780e1db2 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -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; } } -- cgit v1.2.3