← Commit list

cb1ba8650

Denis Vlasenko
Denis Vlasenko
2006-09-22
SOURCE BUG Duration: 47s

Subject

logger: getopt_ulflags'isation

SOURCE BUG

This commit was genuinely broken at the time (not related to our build system): scripts/config/mkconfigs.c (2005-08-01 - 2006-10-05 arasi) uretilen bbconfigopts.h icine .config satirlarini kacissiz, ham newline'larla gömüyordu - gecerli C degildi, busybox'un kendi bb_mkdep araci bile parse edemiyordu (7d219aab7 ile duzeltildi, mkconfigs shell scripte cevrildi)

→ Bu hatanin tam hikayesini ve duzeltme diffini gor

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

sysklogd/logger.c+7 -16
@@ -89,30 +89,21 @@ static int pencode(char *s)
int logger_main(int argc, char **argv)
{
+ unsigned long opt;
+ char *opt_p, *opt_t;
int pri = LOG_USER | LOG_NOTICE;
int option = 0;
- int c, i, opt;
+ int c, i;
char buf[1024], name[128];
/* Fill out the name string early (may be overwritten later) */
bb_getpwuid(name, geteuid(), sizeof(name));
/* Parse any options */
- while ((opt = getopt(argc, argv, "p:st:")) > 0) {
- switch (opt) {
- case 's':
- option |= LOG_PERROR;
- break;
- case 'p':
- pri = pencode(optarg);
- break;
- case 't':
- safe_strncpy(name, optarg, sizeof(name));
- break;
- default:
- bb_show_usage();
- }
- }
+ opt = bb_getopt_ulflags(argc, argv, "p:st:", &opt_p, &opt_t);
+ if (opt & 0x1) pri = pencode(opt_p); // -p
+ if (opt & 0x2) option |= LOG_PERROR; // -s
+ if (opt & 0x4) safe_strncpy(name, opt_t, sizeof(name)); // -t
openlog(name, option, 0);
if (optind == argc) {