mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-01-22 12:45:16 +08:00
Fix wrong size in xy_getcmd()
This commit is contained in:
parent
b5b32bcee8
commit
629e860ae9
4
xy.h
4
xy.h
|
@ -447,14 +447,14 @@ xy_getcmd(const char* cmd, bool (*func)(const char*))
|
|||
|
||||
FILE* stream = popen(cmd, "r");
|
||||
if (stream == NULL) {
|
||||
fprintf(stderr, "命令执行失败\n");
|
||||
fprintf(stderr, "xy: 命令执行失败\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char* ret = NULL;
|
||||
|
||||
while (true) {
|
||||
if(NULL==fgets(buf, sizeof(buf), stream)) break;
|
||||
if(NULL==fgets(buf, size, stream)) break;
|
||||
ret = buf;
|
||||
if (func) { func(buf); }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user