Skip to content

Commit 6579e52

Browse files
committed
Fix macOS build error
1 parent 909391c commit 6579e52

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

include/chsrc.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,8 +779,11 @@ chsrc_ensure_root ()
779779
if (0!=atoi(euid)) goto not_root;
780780
else return;
781781
}
782+
783+
char *msg = NULL;
782784
not_root:
783-
char *msg = CliOpt_InEnglish ? "Use sudo before the command or switch to root to ensure the necessary permissions" : "请在命令前使用 sudo 或切换为root用户来保证必要的权限";
785+
msg = CliOpt_InEnglish ? "Use sudo before the command or switch to root to ensure the necessary permissions"
786+
: "请在命令前使用 sudo 或切换为root用户来保证必要的权限";
784787
chsrc_error (msg);
785788
exit (Exit_UserCause);
786789
}

include/xy.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,11 @@ _xy_str_to_terminal_style (int style, const char *str)
300300
color_fmt_str = "\e[9m%s\e[0m"; break;
301301
}
302302

303+
304+
size_t len = 0;
303305
new_str:
304306
// -2 把中间%s减掉
305-
size_t len = strlen (color_fmt_str) - 2;
307+
len = strlen (color_fmt_str) - 2;
306308
char *buf = malloc (strlen (str) + len + 1);
307309
sprintf (buf, color_fmt_str, str);
308310
return buf;

0 commit comments

Comments
 (0)