mirror of
https://github.com/springzfx/cgproxy.git
synced 2026-02-09 21:14:57 +08:00
remove path max len limit
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#include "common.h"
|
||||
#include <fstream>
|
||||
#include <limits.h>
|
||||
#include <linux/limits.h>
|
||||
#include <regex>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
@@ -54,7 +52,6 @@ vector<int> bash_pidof(const string &path) {
|
||||
FILE *fp = popen(to_str("pidof ", path).c_str(), "r");
|
||||
if (!fp) return pids;
|
||||
int pid;
|
||||
char buf[64];
|
||||
while (fscanf(fp, "%d", &pid) != EOF) { pids.push_back(pid); }
|
||||
pclose(fp);
|
||||
return pids;
|
||||
@@ -64,8 +61,8 @@ string bash_which(const string &name) {
|
||||
stringstream buffer;
|
||||
FILE *fp = popen(to_str("which ", name).c_str(), "r");
|
||||
if (!fp) return "";
|
||||
char buf[64];
|
||||
while (fgets(buf, 64, fp) != NULL) { buffer << buf; }
|
||||
char buf[READ_SIZE_MAX];
|
||||
while (fgets(buf, READ_SIZE_MAX, fp) != NULL) { buffer << buf; }
|
||||
pclose(fp);
|
||||
string s = buffer.str();
|
||||
s.pop_back(); // remove newline character
|
||||
@@ -76,8 +73,8 @@ string bash_readlink(const string &path) {
|
||||
stringstream buffer;
|
||||
FILE *fp = popen(to_str("readlink -e ", path).c_str(), "r");
|
||||
if (!fp) return "";
|
||||
char buf[64];
|
||||
while (fgets(buf, 64, fp) != NULL) { buffer << buf; }
|
||||
char buf[READ_SIZE_MAX];
|
||||
while (fgets(buf, READ_SIZE_MAX, fp) != NULL) { buffer << buf; }
|
||||
pclose(fp);
|
||||
string s = buffer.str();
|
||||
s.pop_back(); // remove newline character
|
||||
|
||||
Reference in New Issue
Block a user