style fixes. No code changes

This commit is contained in:
Denis Vlasenko 2007-04-12 00:32:05 +00:00
parent 50f7f446ec
commit 51742f4bb0
30 changed files with 84 additions and 82 deletions

View File

@ -2145,7 +2145,8 @@ static var *evaluate(node *op, var *res)
X.rsm = newfile(R.s); X.rsm = newfile(R.s);
if (! X.rsm->F) { if (! X.rsm->F) {
if (opn == '|') { if (opn == '|') {
if((X.rsm->F = popen(R.s, "w")) == NULL) X.rsm->F = popen(R.s, "w");
if (X.rsm->F == NULL)
bb_perror_msg_and_die("popen"); bb_perror_msg_and_die("popen");
X.rsm->is_pipe = 1; X.rsm->is_pipe = 1;
} else { } else {

View File

@ -62,7 +62,9 @@ static char *extract_filename(char *line, int patch_level)
/* skip over (patch_level) number of leading directories */ /* skip over (patch_level) number of leading directories */
for (i = 0; i < patch_level; i++) { for (i = 0; i < patch_level; i++) {
if(!(temp = strchr(filename_start_ptr, '/'))) break; temp = strchr(filename_start_ptr, '/');
if (!temp)
break;
filename_start_ptr = temp + 1; filename_start_ptr = temp + 1;
} }

View File

@ -50,16 +50,16 @@ int get_console_fd(void)
for (fd = 2; fd >= 0; fd--) { for (fd = 2; fd >= 0; fd--) {
int fd4name; int fd4name;
int choise_fd; int choice_fd;
char arg; char arg;
fd4name = open_a_console(console_names[fd]); fd4name = open_a_console(console_names[fd]);
chk_std: chk_std:
choise_fd = (fd4name >= 0 ? fd4name : fd); choice_fd = (fd4name >= 0 ? fd4name : fd);
arg = 0; arg = 0;
if (ioctl(choise_fd, KDGKBTYPE, &arg) == 0) if (ioctl(choice_fd, KDGKBTYPE, &arg) == 0)
return choise_fd; return choice_fd;
if (fd4name >= 0) { if (fd4name >= 0) {
close(fd4name); close(fd4name);
fd4name = -1; fd4name = -1;

View File

@ -27,7 +27,8 @@ char *bb_get_chunk_from_file(FILE * file, int *end)
while ((ch = getc(file)) != EOF) { while ((ch = getc(file)) != EOF) {
/* grow the line buffer as necessary */ /* grow the line buffer as necessary */
if (idx >= linebufsz) { if (idx >= linebufsz) {
linebuf = xrealloc(linebuf, linebufsz += 80); linebufsz += 80;
linebuf = xrealloc(linebuf, linebufsz);
} }
linebuf[idx++] = (char) ch; linebuf[idx++] = (char) ch;
if (!ch || (end && ch == '\n')) if (!ch || (end && ch == '\n'))

View File

@ -8,12 +8,8 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details. * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/ */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "libbb.h" #include "libbb.h"
void trim(char *s) void trim(char *s)
{ {
size_t len = strlen(s); size_t len = strlen(s);
@ -27,5 +23,5 @@ void trim(char *s)
lws = strspn(s, " \n\r\t\v"); lws = strspn(s, " \n\r\t\v");
memmove(s, s + lws, len -= lws); memmove(s, s + lws, len -= lws);
} }
s[len] = 0; s[len] = '\0';
} }

View File

@ -46,11 +46,11 @@ int rmmod_main(int argc, char **argv)
/* Parse command line. */ /* Parse command line. */
n = getopt32(argc, argv, "wfa"); n = getopt32(argc, argv, "wfa");
if((n & 1)) // --wait if (n & 1) // --wait
flags &= ~O_NONBLOCK; flags &= ~O_NONBLOCK;
if((n & 2)) // --force if (n & 2) // --force
flags |= O_TRUNC; flags |= O_TRUNC;
if((n & 4)) { if (n & 4) {
/* Unload _all_ unused modules via NULL delete_module() call */ /* Unload _all_ unused modules via NULL delete_module() call */
/* until the number of modules does not change */ /* until the number of modules does not change */
size_t nmod = 0; /* number of modules */ size_t nmod = 0; /* number of modules */

View File

@ -301,14 +301,16 @@ int sysctl_display_all(const char *path, int output, int show_table)
char *tmpdir; char *tmpdir;
struct stat ts; struct stat ts;
if (!(dp = opendir(path))) { dp = opendir(path);
if (!dp) {
retval = -1; retval = -1;
} else { } else {
while ((de = readdir(dp)) != NULL) { while ((de = readdir(dp)) != NULL) {
tmpdir = concat_subpath_file(path, de->d_name); tmpdir = concat_subpath_file(path, de->d_name);
if (tmpdir == NULL) if (tmpdir == NULL)
continue; continue;
if ((retval2 = stat(tmpdir, &ts)) != 0) retval2 = stat(tmpdir, &ts);
if (retval2 != 0)
bb_perror_msg(tmpdir); bb_perror_msg(tmpdir);
else { else {
if (S_ISDIR(ts.st_mode)) { if (S_ISDIR(ts.st_mode)) {

View File

@ -24,7 +24,7 @@
#define MS_MOVE 8192 #define MS_MOVE 8192
#endif #endif
dev_t rootdev; static dev_t rootdev;
// Recursively delete contents of rootfs. // Recursively delete contents of rootfs.
@ -39,7 +39,8 @@ static void delete_contents(const char *directory)
// Recursively delete the contents of directories. // Recursively delete the contents of directories.
if (S_ISDIR(st.st_mode)) { if (S_ISDIR(st.st_mode)) {
if((dir = opendir(directory))) { dir = opendir(directory);
if (dir) {
while ((d = readdir(dir))) { while ((d = readdir(dir))) {
char *newdir = d->d_name; char *newdir = d->d_name;
@ -88,7 +89,7 @@ int switch_root_main(int argc, char **argv)
// Additional sanity checks: we're about to rm -rf /, so be REALLY SURE // Additional sanity checks: we're about to rm -rf /, so be REALLY SURE
// we mean it. (I could make this a CONFIG option, but I would get email // we mean it. (I could make this a CONFIG option, but I would get email
// from all the people who WILL eat their filesystemss.) // from all the people who WILL eat their filesystems.)
if (lstat("/init", &st1) || !S_ISREG(st1.st_mode) || statfs("/", &stfs) || if (lstat("/init", &st1) || !S_ISREG(st1.st_mode) || statfs("/", &stfs) ||
(stfs.f_type != RAMFS_MAGIC && stfs.f_type != TMPFS_MAGIC) || (stfs.f_type != RAMFS_MAGIC && stfs.f_type != TMPFS_MAGIC) ||
@ -105,14 +106,13 @@ int switch_root_main(int argc, char **argv)
// recalculate "." and ".." links. // recalculate "." and ".." links.
if (mount(".", "/", NULL, MS_MOVE, NULL) || chroot(".") || chdir("/")) if (mount(".", "/", NULL, MS_MOVE, NULL) || chroot(".") || chdir("/"))
bb_error_msg_and_die("moving root"); bb_error_msg_and_die("error moving root");
// If a new console specified, redirect stdin/stdout/stderr to that. // If a new console specified, redirect stdin/stdout/stderr to that.
if (console) { if (console) {
close(0); close(0);
if (open(console, O_RDWR) < 0) xopen(console, O_RDWR);
bb_error_msg_and_die("bad console '%s'", console);
dup2(0, 1); dup2(0, 1);
dup2(0, 2); dup2(0, 2);
} }