diff options
| author | Eric Andersen <andersen@codepoet.org> | 2002-10-10 04:20:21 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2002-10-10 04:20:21 +0000 |
| commit | 71ae64bdc6b044eef0a9f3bebd85cc4a6b67362f (patch) | |
| tree | 802990cf39a805f253b9d32f3888a7c749babd01 | |
| parent | fdfe298a966da0e6eecdc355efd640acf73c00e5 (diff) | |
| download | busybox-w32-71ae64bdc6b044eef0a9f3bebd85cc4a6b67362f.tar.gz busybox-w32-71ae64bdc6b044eef0a9f3bebd85cc4a6b67362f.tar.bz2 busybox-w32-71ae64bdc6b044eef0a9f3bebd85cc4a6b67362f.zip | |
last_patch61 from vodz:
New complex patch for decrease size devel version. Requires previous patch.
Also removed small problems from dutmp and tar applets.
Also includes vodz' last_patch61_2:
Last patch correcting comment for #endif and more integrated
with libbb (very reduce size if used "cat" applet also).
Requires last_patch61 for modutils/config.in.
| -rw-r--r-- | archival/libunarchive/data_extract_all.c | 2 | ||||
| -rw-r--r-- | archival/tar.c | 12 | ||||
| -rw-r--r-- | console-tools/dumpkmap.c | 2 | ||||
| -rw-r--r-- | init/init.c | 7 | ||||
| -rw-r--r-- | libbb/messages.c | 2 | ||||
| -rw-r--r-- | libbb/obscure.c | 62 | ||||
| -rw-r--r-- | loginutils/getty.c | 24 | ||||
| -rw-r--r-- | loginutils/login.c | 14 | ||||
| -rw-r--r-- | miscutils/dutmp.c | 2 | ||||
| -rw-r--r-- | modutils/config.in | 4 | ||||
| -rw-r--r-- | modutils/insmod.c | 8 | ||||
| -rw-r--r-- | modutils/lsmod.c | 26 |
12 files changed, 76 insertions, 89 deletions
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c index 39af2e3e7..f839be35e 100644 --- a/archival/libunarchive/data_extract_all.c +++ b/archival/libunarchive/data_extract_all.c | |||
| @@ -16,7 +16,7 @@ extern void data_extract_all(archive_handle_t *archive_handle) | |||
| 16 | int res; | 16 | int res; |
| 17 | 17 | ||
| 18 | if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) { | 18 | if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) { |
| 19 | char *name = strdup(file_header->name); | 19 | char *name = xstrdup(file_header->name); |
| 20 | make_directory (dirname(name), 0777, FILEUTILS_RECUR); | 20 | make_directory (dirname(name), 0777, FILEUTILS_RECUR); |
| 21 | free(name); | 21 | free(name); |
| 22 | } | 22 | } |
diff --git a/archival/tar.c b/archival/tar.c index e6c134e3b..dba6bbcc4 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
| @@ -302,7 +302,7 @@ static inline int writeTarHeader(struct TarBallInfo *tbInfo, | |||
| 302 | if ((size = | 302 | if ((size = |
| 303 | full_write(tbInfo->tarFd, (char *) &header, | 303 | full_write(tbInfo->tarFd, (char *) &header, |
| 304 | sizeof(struct TarHeader))) < 0) { | 304 | sizeof(struct TarHeader))) < 0) { |
| 305 | error_msg(io_error, real_name, strerror(errno)); | 305 | error_msg(io_error, real_name); |
| 306 | return (FALSE); | 306 | return (FALSE); |
| 307 | } | 307 | } |
| 308 | /* Pad the header up to the tar block size */ | 308 | /* Pad the header up to the tar block size */ |
| @@ -426,7 +426,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, | |||
| 426 | 426 | ||
| 427 | /* open the file we want to archive, and make sure all is well */ | 427 | /* open the file we want to archive, and make sure all is well */ |
| 428 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { | 428 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { |
| 429 | error_msg("%s: Cannot open: %s", fileName, strerror(errno)); | 429 | perror_msg("%s: Cannot open", fileName); |
| 430 | return (FALSE); | 430 | return (FALSE); |
| 431 | } | 431 | } |
| 432 | 432 | ||
| @@ -434,13 +434,13 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, | |||
| 434 | while ((size = full_read(inputFileFd, buffer, sizeof(buffer))) > 0) { | 434 | while ((size = full_read(inputFileFd, buffer, sizeof(buffer))) > 0) { |
| 435 | if (full_write(tbInfo->tarFd, buffer, size) != size) { | 435 | if (full_write(tbInfo->tarFd, buffer, size) != size) { |
| 436 | /* Output file seems to have a problem */ | 436 | /* Output file seems to have a problem */ |
| 437 | error_msg(io_error, fileName, strerror(errno)); | 437 | error_msg(io_error, fileName); |
| 438 | return (FALSE); | 438 | return (FALSE); |
| 439 | } | 439 | } |
| 440 | readSize += size; | 440 | readSize += size; |
| 441 | } | 441 | } |
| 442 | if (size == -1) { | 442 | if (size == -1) { |
| 443 | error_msg(io_error, fileName, strerror(errno)); | 443 | error_msg(io_error, fileName); |
| 444 | return (FALSE); | 444 | return (FALSE); |
| 445 | } | 445 | } |
| 446 | /* Pad the file up to the tar block size */ | 446 | /* Pad the file up to the tar block size */ |
| @@ -483,7 +483,7 @@ static inline int writeTarFile(const char *tarName, const int verboseFlag, | |||
| 483 | } | 483 | } |
| 484 | 484 | ||
| 485 | if (tbInfo.tarFd < 0) { | 485 | if (tbInfo.tarFd < 0) { |
| 486 | perror_msg("Error opening '%s'", tarName); | 486 | perror_msg("%s: Cannot open", tarName); |
| 487 | freeHardLinkInfo(&tbInfo.hlInfoHead); | 487 | freeHardLinkInfo(&tbInfo.hlInfoHead); |
| 488 | return (FALSE); | 488 | return (FALSE); |
| 489 | } | 489 | } |
| @@ -491,7 +491,7 @@ static inline int writeTarFile(const char *tarName, const int verboseFlag, | |||
| 491 | /* Store the stat info for the tarball's file, so | 491 | /* Store the stat info for the tarball's file, so |
| 492 | * can avoid including the tarball into itself.... */ | 492 | * can avoid including the tarball into itself.... */ |
| 493 | if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0) | 493 | if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0) |
| 494 | error_msg_and_die(io_error, tarName, strerror(errno)); | 494 | error_msg_and_die(io_error, tarName); |
| 495 | 495 | ||
| 496 | #ifdef CONFIG_FEATURE_TAR_GZIP | 496 | #ifdef CONFIG_FEATURE_TAR_GZIP |
| 497 | if (gzip) { | 497 | if (gzip) { |
diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c index 22652a5e2..d2bb6dcff 100644 --- a/console-tools/dumpkmap.c +++ b/console-tools/dumpkmap.c | |||
| @@ -81,7 +81,7 @@ int dumpkmap_main(int argc, char **argv) | |||
| 81 | ke.kb_table = i; | 81 | ke.kb_table = i; |
| 82 | if (ioctl(fd, KDGKBENT, &ke) < 0) { | 82 | if (ioctl(fd, KDGKBENT, &ke) < 0) { |
| 83 | 83 | ||
| 84 | error_msg("ioctl returned: %s, %s, %s, %xqq", strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); | 84 | error_msg("ioctl returned: %m, %s, %s, %xqq", (char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); |
| 85 | } | 85 | } |
| 86 | else { | 86 | else { |
| 87 | write(1,(void*)&ke.kb_value,2); | 87 | write(1,(void*)&ke.kb_value,2); |
diff --git a/init/init.c b/init/init.c index 3b0a66a24..edbd90bfe 100644 --- a/init/init.c +++ b/init/init.c | |||
| @@ -660,8 +660,7 @@ static pid_t run(struct init_action *a) | |||
| 660 | execve(cmdpath, cmd, environment); | 660 | execve(cmdpath, cmd, environment); |
| 661 | 661 | ||
| 662 | /* We're still here? Some error happened. */ | 662 | /* We're still here? Some error happened. */ |
| 663 | message(LOG | CONSOLE, "\rBummer, could not run '%s': %s\n", cmdpath, | 663 | message(LOG | CONSOLE, "\rBummer, could not run '%s': %m\n", cmdpath); |
| 664 | strerror(errno)); | ||
| 665 | _exit(-1); | 664 | _exit(-1); |
| 666 | } | 665 | } |
| 667 | sigprocmask(SIG_SETMASK, &omask, NULL); | 666 | sigprocmask(SIG_SETMASK, &omask, NULL); |
| @@ -785,8 +784,8 @@ static void exec_signal(int sig) | |||
| 785 | message(CONSOLE | LOG, "\rTrying to re-exec %s\n", a->command); | 784 | message(CONSOLE | LOG, "\rTrying to re-exec %s\n", a->command); |
| 786 | execl(a->command, a->command, NULL); | 785 | execl(a->command, a->command, NULL); |
| 787 | 786 | ||
| 788 | message(CONSOLE | LOG, "\rexec of '%s' failed: %s\n", | 787 | message(CONSOLE | LOG, "\rexec of '%s' failed: %m\n", |
| 789 | a->command, strerror(errno)); | 788 | a->command); |
| 790 | sync(); | 789 | sync(); |
| 791 | sleep(2); | 790 | sleep(2); |
| 792 | init_reboot(RB_HALT_SYSTEM); | 791 | init_reboot(RB_HALT_SYSTEM); |
diff --git a/libbb/messages.c b/libbb/messages.c index 185c1ee91..cc7e2146c 100644 --- a/libbb/messages.c +++ b/libbb/messages.c | |||
| @@ -45,7 +45,7 @@ | |||
| 45 | const char * const invalid_option = "invalid option -- %c"; | 45 | const char * const invalid_option = "invalid option -- %c"; |
| 46 | #endif | 46 | #endif |
| 47 | #ifdef L_io_error | 47 | #ifdef L_io_error |
| 48 | const char * const io_error = "%s: input/output error -- %s"; | 48 | const char * const io_error = "%s: input/output error -- %m"; |
| 49 | #endif | 49 | #endif |
| 50 | #ifdef L_dash_dash_help | 50 | #ifdef L_dash_dash_help |
| 51 | const char * const dash_dash_help = "--help"; | 51 | const char * const dash_dash_help = "--help"; |
diff --git a/libbb/obscure.c b/libbb/obscure.c index dc7de751d..588ef5af6 100644 --- a/libbb/obscure.c +++ b/libbb/obscure.c | |||
| @@ -44,7 +44,7 @@ | |||
| 44 | * can't be a palindrome - like `R A D A R' or `M A D A M' | 44 | * can't be a palindrome - like `R A D A R' or `M A D A M' |
| 45 | */ | 45 | */ |
| 46 | 46 | ||
| 47 | static int palindrome(const char *old, const char *newval) | 47 | static int palindrome(const char *newval) |
| 48 | { | 48 | { |
| 49 | int i, j; | 49 | int i, j; |
| 50 | 50 | ||
| @@ -79,24 +79,25 @@ static int similiar(const char *old, const char *newval) | |||
| 79 | * a nice mix of characters. | 79 | * a nice mix of characters. |
| 80 | */ | 80 | */ |
| 81 | 81 | ||
| 82 | static int simple(const char *old, const char *newval) | 82 | static int simple(const char *newval) |
| 83 | { | 83 | { |
| 84 | int digits = 0; | 84 | int digits = 0; |
| 85 | int uppers = 0; | 85 | int uppers = 0; |
| 86 | int lowers = 0; | 86 | int lowers = 0; |
| 87 | int others = 0; | 87 | int others = 0; |
| 88 | int c; | ||
| 88 | int size; | 89 | int size; |
| 89 | int i; | 90 | int i; |
| 90 | 91 | ||
| 91 | for (i = 0; newval[i]; i++) { | 92 | for (i = 0; (c = *newval++) != 0; i++) { |
| 92 | if (isdigit(newval[i])) | 93 | if (isdigit(c)) |
| 93 | digits++; | 94 | digits = c; |
| 94 | else if (isupper(newval[i])) | 95 | else if (isupper(c)) |
| 95 | uppers++; | 96 | uppers = c; |
| 96 | else if (islower(newval[i])) | 97 | else if (islower(c)) |
| 97 | lowers++; | 98 | lowers = c; |
| 98 | else | 99 | else |
| 99 | others++; | 100 | others = c; |
| 100 | } | 101 | } |
| 101 | 102 | ||
| 102 | /* | 103 | /* |
| @@ -129,49 +130,50 @@ static char *str_lower(char *string) | |||
| 129 | return string; | 130 | return string; |
| 130 | } | 131 | } |
| 131 | 132 | ||
| 132 | static char *password_check(const char *old, const char *newval, const struct passwd *pwdp) | 133 | static const char * |
| 134 | password_check(const char *old, const char *newval, const struct passwd *pwdp) | ||
| 133 | { | 135 | { |
| 134 | char *msg = NULL; | 136 | const char *msg; |
| 135 | char *oldmono, *newmono, *wrapped; | 137 | char *newmono, *wrapped; |
| 138 | int lenwrap; | ||
| 136 | 139 | ||
| 137 | if (strcmp(newval, old) == 0) | 140 | if (strcmp(newval, old) == 0) |
| 138 | return "no change"; | 141 | return "no change"; |
| 142 | if (simple(newval)) | ||
| 143 | return "too simple"; | ||
| 139 | 144 | ||
| 145 | msg = NULL; | ||
| 140 | newmono = str_lower(xstrdup(newval)); | 146 | newmono = str_lower(xstrdup(newval)); |
| 141 | oldmono = str_lower(xstrdup(old)); | 147 | lenwrap = strlen(old) * 2 + 1; |
| 142 | wrapped = (char *) xmalloc(strlen(oldmono) * 2 + 1); | 148 | wrapped = (char *) xmalloc(lenwrap); |
| 143 | strcpy(wrapped, oldmono); | 149 | str_lower(strcpy(wrapped, old)); |
| 144 | strcat(wrapped, oldmono); | ||
| 145 | 150 | ||
| 146 | if (palindrome(oldmono, newmono)) | 151 | if (palindrome(newmono)) |
| 147 | msg = "a palindrome"; | 152 | msg = "a palindrome"; |
| 148 | 153 | ||
| 149 | if (!msg && strcmp(oldmono, newmono) == 0) | 154 | else if (strcmp(wrapped, newmono) == 0) |
| 150 | msg = "case changes only"; | 155 | msg = "case changes only"; |
| 151 | 156 | ||
| 152 | if (!msg && similiar(oldmono, newmono)) | 157 | else if (similiar(wrapped, newmono)) |
| 153 | msg = "too similiar"; | 158 | msg = "too similiar"; |
| 154 | 159 | ||
| 155 | if (!msg && simple(old, newval)) | 160 | else if (strstr(strcat(wrapped, wrapped), newmono)) |
| 156 | msg = "too simple"; | ||
| 157 | |||
| 158 | if (!msg && strstr(wrapped, newmono)) | ||
| 159 | msg = "rotated"; | 161 | msg = "rotated"; |
| 160 | 162 | ||
| 161 | bzero(newmono, strlen(newmono)); | 163 | bzero(newmono, strlen(newmono)); |
| 162 | bzero(oldmono, strlen(oldmono)); | 164 | bzero(wrapped, lenwrap); |
| 163 | bzero(wrapped, strlen(wrapped)); | ||
| 164 | free(newmono); | 165 | free(newmono); |
| 165 | free(oldmono); | ||
| 166 | free(wrapped); | 166 | free(wrapped); |
| 167 | 167 | ||
| 168 | return msg; | 168 | return msg; |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | static char *obscure_msg(const char *old, const char *newval, const struct passwd *pwdp) | 171 | static const char * |
| 172 | obscure_msg(const char *old, const char *newval, const struct passwd *pwdp) | ||
| 172 | { | 173 | { |
| 173 | int maxlen, oldlen, newlen; | 174 | int maxlen, oldlen, newlen; |
| 174 | char *new1, *old1, *msg; | 175 | char *new1, *old1; |
| 176 | const char *msg; | ||
| 175 | 177 | ||
| 176 | oldlen = strlen(old); | 178 | oldlen = strlen(old); |
| 177 | newlen = strlen(newval); | 179 | newlen = strlen(newval); |
| @@ -233,7 +235,7 @@ static char *obscure_msg(const char *old, const char *newval, const struct passw | |||
| 233 | 235 | ||
| 234 | extern int obscure(const char *old, const char *newval, const struct passwd *pwdp) | 236 | extern int obscure(const char *old, const char *newval, const struct passwd *pwdp) |
| 235 | { | 237 | { |
| 236 | char *msg = obscure_msg(old, newval, pwdp); | 238 | const char *msg = obscure_msg(old, newval, pwdp); |
| 237 | 239 | ||
| 238 | /* if (msg) { */ | 240 | /* if (msg) { */ |
| 239 | if (msg != NULL) { | 241 | if (msg != NULL) { |
diff --git a/loginutils/getty.c b/loginutils/getty.c index fec8ae8e5..0f0778caf 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
| @@ -388,34 +388,20 @@ static void parse_args(int argc, char **argv, struct options *op) | |||
| 388 | switch (c) { | 388 | switch (c) { |
| 389 | case 'I': | 389 | case 'I': |
| 390 | if (!(op->initstring = strdup(optarg))) | 390 | if (!(op->initstring = strdup(optarg))) |
| 391 | error("can't malloc initstring"); | 391 | error(memory_exhausted); |
| 392 | 392 | ||
| 393 | { | 393 | { |
| 394 | char ch, *p, *q; | 394 | const char *p; |
| 395 | int i; | 395 | char *q; |
| 396 | 396 | ||
| 397 | /* copy optarg into op->initstring decoding \ddd | 397 | /* copy optarg into op->initstring decoding \ddd |
| 398 | octal codes into chars */ | 398 | octal codes into chars */ |
| 399 | q = op->initstring; | 399 | q = op->initstring; |
| 400 | p = optarg; | 400 | p = optarg; |
| 401 | while (*p) { | 401 | while (*p) { |
| 402 | if (*p == '\\') { /* know \\ means \ */ | 402 | if (*p == '\\') { |
| 403 | p++; | 403 | p++; |
| 404 | if (*p == '\\') { | 404 | *q++ = process_escape_sequence(&p); |
| 405 | ch = '\\'; | ||
| 406 | p++; | ||
| 407 | } else { /* handle \000 - \177 */ | ||
| 408 | ch = 0; | ||
| 409 | for (i = 1; i <= 3; i++) { | ||
| 410 | if (*p >= '0' && *p <= '7') { | ||
| 411 | ch <<= 3; | ||
| 412 | ch += *p - '0'; | ||
| 413 | p++; | ||
| 414 | } else | ||
| 415 | break; | ||
| 416 | } | ||
| 417 | } | ||
| 418 | *q++ = ch; | ||
| 419 | } else { | 405 | } else { |
| 420 | *q++ = *p++; | 406 | *q++ = *p++; |
| 421 | } | 407 | } |
diff --git a/loginutils/login.c b/loginutils/login.c index 714829db1..6b8f6c651 100644 --- a/loginutils/login.c +++ b/loginutils/login.c | |||
| @@ -22,20 +22,15 @@ | |||
| 22 | // import from utmp.c | 22 | // import from utmp.c |
| 23 | static void checkutmp(int picky); | 23 | static void checkutmp(int picky); |
| 24 | static void setutmp(const char *name, const char *line); | 24 | static void setutmp(const char *name, const char *line); |
| 25 | /* Stuff global to this file */ | ||
| 26 | struct utmp utent; | ||
| 25 | #endif | 27 | #endif |
| 26 | 28 | ||
| 27 | // import from encrypt.c | ||
| 28 | extern char *pw_encrypt(const char *clear, const char *salt); | ||
| 29 | |||
| 30 | |||
| 31 | // login defines | 29 | // login defines |
| 32 | #define TIMEOUT 60 | 30 | #define TIMEOUT 60 |
| 33 | #define EMPTY_USERNAME_COUNT 10 | 31 | #define EMPTY_USERNAME_COUNT 10 |
| 34 | #define USERNAME_SIZE 32 | 32 | #define USERNAME_SIZE 32 |
| 35 | 33 | ||
| 36 | /* Stuff global to this file */ | ||
| 37 | struct utmp utent; | ||
| 38 | |||
| 39 | 34 | ||
| 40 | static int check_nologin ( int amroot ); | 35 | static int check_nologin ( int amroot ); |
| 41 | 36 | ||
| @@ -131,12 +126,15 @@ extern int login_main(int argc, char **argv) | |||
| 131 | else | 126 | else |
| 132 | safe_strncpy ( tty, "UNKNOWN", sizeof( tty )); | 127 | safe_strncpy ( tty, "UNKNOWN", sizeof( tty )); |
| 133 | 128 | ||
| 129 | #ifdef CONFIG_FEATURE_U_W_TMP | ||
| 134 | if ( amroot ) | 130 | if ( amroot ) |
| 135 | memset ( utent.ut_host, 0, sizeof utent.ut_host ); | 131 | memset ( utent.ut_host, 0, sizeof utent.ut_host ); |
| 132 | #endif | ||
| 136 | 133 | ||
| 137 | if ( opt_host ) { | 134 | if ( opt_host ) { |
| 135 | #ifdef CONFIG_FEATURE_U_W_TMP | ||
| 138 | safe_strncpy ( utent.ut_host, opt_host, sizeof( utent. ut_host )); | 136 | safe_strncpy ( utent.ut_host, opt_host, sizeof( utent. ut_host )); |
| 139 | 137 | #endif | |
| 140 | snprintf ( fromhost, sizeof( fromhost ) - 1, " on `%.100s' from `%.200s'", tty, opt_host ); | 138 | snprintf ( fromhost, sizeof( fromhost ) - 1, " on `%.100s' from `%.200s'", tty, opt_host ); |
| 141 | } | 139 | } |
| 142 | else | 140 | else |
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c index cec5629c8..19e09fbb0 100644 --- a/miscutils/dutmp.c +++ b/miscutils/dutmp.c | |||
| @@ -34,7 +34,7 @@ extern int dutmp_main(int argc, char **argv) | |||
| 34 | } else { | 34 | } else { |
| 35 | file = open(argv[1], O_RDONLY); | 35 | file = open(argv[1], O_RDONLY); |
| 36 | if (file < 0) { | 36 | if (file < 0) { |
| 37 | perror_msg_and_die(io_error, argv[1]); | 37 | error_msg_and_die(io_error, argv[1]); |
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| 40 | 40 | ||
diff --git a/modutils/config.in b/modutils/config.in index 7fe7ec195..10b0a9c33 100644 --- a/modutils/config.in +++ b/modutils/config.in | |||
| @@ -29,5 +29,9 @@ if [ "$CONFIG_LSMOD" = "y" ]; then | |||
| 29 | fi | 29 | fi |
| 30 | fi | 30 | fi |
| 31 | 31 | ||
| 32 | if [ "$CONFIG_INSMOD" = "y" -o "$CONFIG_LSMOD" = "y" ]; then | ||
| 33 | bool 'Support tainted module checking with new kernels' CONFIG_FEATURE_CHECK_TAINTED_MODULE | ||
| 34 | fi | ||
| 35 | |||
| 32 | endmenu | 36 | endmenu |
| 33 | 37 | ||
diff --git a/modutils/insmod.c b/modutils/insmod.c index b246d90af..b367e84af 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
| @@ -234,7 +234,7 @@ | |||
| 234 | #ifndef MODUTILS_MODULE_H | 234 | #ifndef MODUTILS_MODULE_H |
| 235 | static const int MODUTILS_MODULE_H = 1; | 235 | static const int MODUTILS_MODULE_H = 1; |
| 236 | 236 | ||
| 237 | #ident "$Id: insmod.c,v 1.90 2002/09/16 05:30:24 andersen Exp $" | 237 | #ident "$Id: insmod.c,v 1.91 2002/10/10 04:20:21 andersen Exp $" |
| 238 | 238 | ||
| 239 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 239 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
| 240 | We do not use the kernel headers directly because we do not wish | 240 | We do not use the kernel headers directly because we do not wish |
| @@ -455,7 +455,7 @@ int delete_module(const char *); | |||
| 455 | #ifndef MODUTILS_OBJ_H | 455 | #ifndef MODUTILS_OBJ_H |
| 456 | static const int MODUTILS_OBJ_H = 1; | 456 | static const int MODUTILS_OBJ_H = 1; |
| 457 | 457 | ||
| 458 | #ident "$Id: insmod.c,v 1.90 2002/09/16 05:30:24 andersen Exp $" | 458 | #ident "$Id: insmod.c,v 1.91 2002/10/10 04:20:21 andersen Exp $" |
| 459 | 459 | ||
| 460 | /* The relocatable object is manipulated using elfin types. */ | 460 | /* The relocatable object is manipulated using elfin types. */ |
| 461 | 461 | ||
| @@ -3422,6 +3422,7 @@ static void hide_special_symbols(struct obj_file *f) | |||
| 3422 | ELFW(ST_INFO) (STB_LOCAL, ELFW(ST_TYPE) (sym->info)); | 3422 | ELFW(ST_INFO) (STB_LOCAL, ELFW(ST_TYPE) (sym->info)); |
| 3423 | } | 3423 | } |
| 3424 | 3424 | ||
| 3425 | #ifdef CONFIG_FEATURE_CHECK_TAINTED_MODULE | ||
| 3425 | static int obj_gpl_license(struct obj_file *f, const char **license) | 3426 | static int obj_gpl_license(struct obj_file *f, const char **license) |
| 3426 | { | 3427 | { |
| 3427 | struct obj_section *sec; | 3428 | struct obj_section *sec; |
| @@ -3533,6 +3534,9 @@ static void check_tainted_module(struct obj_file *f, char *m_name) | |||
| 3533 | if (fd >= 0) | 3534 | if (fd >= 0) |
| 3534 | close(fd); | 3535 | close(fd); |
| 3535 | } | 3536 | } |
| 3537 | #else /* CONFIG_FEATURE_CHECK_TAINTED_MODULE */ | ||
| 3538 | #define check_tainted_module(x, y) do { } while(0); | ||
| 3539 | #endif /* CONFIG_FEATURE_CHECK_TAINTED_MODULE */ | ||
| 3536 | 3540 | ||
| 3537 | extern int insmod_main( int argc, char **argv) | 3541 | extern int insmod_main( int argc, char **argv) |
| 3538 | { | 3542 | { |
diff --git a/modutils/lsmod.c b/modutils/lsmod.c index a2a582389..a03247f73 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c | |||
| @@ -40,13 +40,15 @@ | |||
| 40 | #include "busybox.h" | 40 | #include "busybox.h" |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | 43 | #ifndef CONFIG_FEATURE_CHECK_TAINTED_MODULE | |
| 44 | static inline void check_tainted(void) { printf("\n"); } | ||
| 45 | #else | ||
| 44 | #define TAINT_FILENAME "/proc/sys/kernel/tainted" | 46 | #define TAINT_FILENAME "/proc/sys/kernel/tainted" |
| 45 | #define TAINT_PROPRIETORY_MODULE (1<<0) | 47 | #define TAINT_PROPRIETORY_MODULE (1<<0) |
| 46 | #define TAINT_FORCED_MODULE (1<<1) | 48 | #define TAINT_FORCED_MODULE (1<<1) |
| 47 | #define TAINT_UNSAFE_SMP (1<<2) | 49 | #define TAINT_UNSAFE_SMP (1<<2) |
| 48 | 50 | ||
| 49 | void check_tainted(void) | 51 | static void check_tainted(void) |
| 50 | { | 52 | { |
| 51 | int tainted; | 53 | int tainted; |
| 52 | FILE *f; | 54 | FILE *f; |
| @@ -66,6 +68,7 @@ void check_tainted(void) | |||
| 66 | printf(" Not tainted\n"); | 68 | printf(" Not tainted\n"); |
| 67 | } | 69 | } |
| 68 | } | 70 | } |
| 71 | #endif | ||
| 69 | 72 | ||
| 70 | #ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE | 73 | #ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE |
| 71 | 74 | ||
| @@ -111,6 +114,7 @@ static int my_query_module(const char *name, int which, void **buf, | |||
| 111 | 114 | ||
| 112 | return my_ret; | 115 | return my_ret; |
| 113 | } | 116 | } |
| 117 | #endif | ||
| 114 | 118 | ||
| 115 | extern int lsmod_main(int argc, char **argv) | 119 | extern int lsmod_main(int argc, char **argv) |
| 116 | { | 120 | { |
| @@ -170,26 +174,16 @@ extern int lsmod_main(int argc, char **argv) | |||
| 170 | return( 0); | 174 | return( 0); |
| 171 | } | 175 | } |
| 172 | 176 | ||
| 173 | #else /*CONFIG_FEATURE_OLD_MODULE_INTERFACE*/ | 177 | #else /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ |
| 174 | 178 | ||
| 175 | extern int lsmod_main(int argc, char **argv) | 179 | extern int lsmod_main(int argc, char **argv) |
| 176 | { | 180 | { |
| 177 | int fd, i; | ||
| 178 | char line[128]; | ||
| 179 | |||
| 180 | printf("Module Size Used by"); | 181 | printf("Module Size Used by"); |
| 181 | check_tainted(); | 182 | check_tainted(); |
| 182 | fflush(stdout); | ||
| 183 | 183 | ||
| 184 | if ((fd = open("/proc/modules", O_RDONLY)) >= 0 ) { | 184 | if(print_file_by_name("/proc/modules") == FALSE) |
| 185 | while ((i = read(fd, line, sizeof(line))) > 0) { | ||
| 186 | write(fileno(stdout), line, i); | ||
| 187 | } | ||
| 188 | close(fd); | ||
| 189 | return 0; | ||
| 190 | } | ||
| 191 | perror_msg_and_die("/proc/modules"); | ||
| 192 | return 1; | 185 | return 1; |
| 186 | return 0; | ||
| 193 | } | 187 | } |
| 194 | 188 | ||
| 195 | #endif /*CONFIG_FEATURE_OLD_MODULE_INTERFACE*/ | 189 | #endif /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ |
