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);
if (! X.rsm->F) {
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");
X.rsm->is_pipe = 1;
} else {

View File

@ -62,7 +62,9 @@ static char *extract_filename(char *line, int patch_level)
/* skip over (patch_level) number of leading directories */
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;
}

View File

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

View File

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

View File

@ -8,12 +8,8 @@
* 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"
void trim(char *s)
{
size_t len = strlen(s);
@ -27,5 +23,5 @@ void trim(char *s)
lws = strspn(s, " \n\r\t\v");
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. */
n = getopt32(argc, argv, "wfa");
if((n & 1)) // --wait
if (n & 1) // --wait
flags &= ~O_NONBLOCK;
if((n & 2)) // --force
if (n & 2) // --force
flags |= O_TRUNC;
if((n & 4)) {
if (n & 4) {
/* Unload _all_ unused modules via NULL delete_module() call */
/* until the number of modules does not change */
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;
struct stat ts;
if (!(dp = opendir(path))) {
dp = opendir(path);
if (!dp) {
retval = -1;
} else {
while ((de = readdir(dp)) != NULL) {
tmpdir = concat_subpath_file(path, de->d_name);
if (tmpdir == NULL)
continue;
if ((retval2 = stat(tmpdir, &ts)) != 0)
retval2 = stat(tmpdir, &ts);
if (retval2 != 0)
bb_perror_msg(tmpdir);
else {
if (S_ISDIR(ts.st_mode)) {

View File

@ -24,7 +24,7 @@
#define MS_MOVE 8192
#endif
dev_t rootdev;
static dev_t rootdev;
// Recursively delete contents of rootfs.
@ -39,7 +39,8 @@ static void delete_contents(const char *directory)
// Recursively delete the contents of directories.
if (S_ISDIR(st.st_mode)) {
if((dir = opendir(directory))) {
dir = opendir(directory);
if (dir) {
while ((d = readdir(dir))) {
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
// 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) ||
(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.
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 (console) {
close(0);
if (open(console, O_RDWR) < 0)
bb_error_msg_and_die("bad console '%s'", console);
xopen(console, O_RDWR);
dup2(0, 1);
dup2(0, 2);
}