Bug fixes
This commit is contained in:
parent
5d44d1fda5
commit
cb41c2e83b
@ -12,11 +12,11 @@ h=`sort busybox.links | uniq`
|
|||||||
for i in $h ; do
|
for i in $h ; do
|
||||||
mypath=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' `;
|
mypath=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' `;
|
||||||
myapp=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' `;
|
myapp=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' `;
|
||||||
mkdir -p $1$mypath
|
|
||||||
echo " $1$mypath$myapp -> /bin/busybox"
|
echo " $1$mypath$myapp -> /bin/busybox"
|
||||||
(cd $1$mypath ; rm -f $1$mypath$myapp ; ln -s /bin/busybox $1$mypath$myapp )
|
mkdir -p $1$mypath
|
||||||
|
(cd $1$mypath && rm -f $1$mypath$myapp && ln -s /bin/busybox $1$mypath$myapp )
|
||||||
done
|
done
|
||||||
rm -f $1/bin/busybox
|
rm -f $1/bin/busybox
|
||||||
install -m 755 busybox $1/bin/busybox
|
install -m 755 busybox $1/bin/busybox
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
@ -29,10 +29,15 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include <features.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#else
|
||||||
|
typedef unsigned long long int uintmax_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char dd_usage[] =
|
static const char dd_usage[] =
|
||||||
"dd [if=name] [of=name] [bs=n] [count=n]\n\n"
|
"dd [if=name] [of=name] [bs=n] [count=n]\n\n"
|
||||||
|
@ -80,17 +80,21 @@ extern int mkdir_main(int argc, char **argv)
|
|||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
int status;
|
int status;
|
||||||
struct stat statBuf;
|
struct stat statBuf;
|
||||||
status=stat(*argv, &statBuf);
|
char buf[NAME_MAX];
|
||||||
|
|
||||||
|
strcpy (buf, *argv);
|
||||||
|
status=stat(buf, &statBuf);
|
||||||
if (status != -1 && status != ENOENT ) {
|
if (status != -1 && status != ENOENT ) {
|
||||||
fprintf(stderr, "%s: File exists\n", *argv);
|
fprintf(stderr, "%s: File exists\n", buf);
|
||||||
exit( FALSE);
|
exit( FALSE);
|
||||||
}
|
}
|
||||||
if (parentFlag == TRUE) {
|
if (parentFlag == TRUE) {
|
||||||
createPath(*argv, mode);
|
strcat( buf, "/");
|
||||||
|
createPath(buf, mode);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (mkdir (*argv, mode) != 0) {
|
if (mkdir (buf, mode) != 0) {
|
||||||
perror(*argv);
|
perror(buf);
|
||||||
exit( FALSE);
|
exit( FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
dd.c
5
dd.c
@ -29,10 +29,15 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include <features.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#if (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#else
|
||||||
|
typedef unsigned long long int uintmax_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char dd_usage[] =
|
static const char dd_usage[] =
|
||||||
"dd [if=name] [of=name] [bs=n] [count=n]\n\n"
|
"dd [if=name] [of=name] [bs=n] [count=n]\n\n"
|
||||||
|
@ -12,11 +12,11 @@ h=`sort busybox.links | uniq`
|
|||||||
for i in $h ; do
|
for i in $h ; do
|
||||||
mypath=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' `;
|
mypath=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' `;
|
||||||
myapp=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' `;
|
myapp=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' `;
|
||||||
mkdir -p $1$mypath
|
|
||||||
echo " $1$mypath$myapp -> /bin/busybox"
|
echo " $1$mypath$myapp -> /bin/busybox"
|
||||||
(cd $1$mypath ; rm -f $1$mypath$myapp ; ln -s /bin/busybox $1$mypath$myapp )
|
mkdir -p $1$mypath
|
||||||
|
(cd $1$mypath && rm -f $1$mypath$myapp && ln -s /bin/busybox $1$mypath$myapp )
|
||||||
done
|
done
|
||||||
rm -f $1/bin/busybox
|
rm -f $1/bin/busybox
|
||||||
install -m 755 busybox $1/bin/busybox
|
install -m 755 busybox $1/bin/busybox
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
14
mkdir.c
14
mkdir.c
@ -80,17 +80,21 @@ extern int mkdir_main(int argc, char **argv)
|
|||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
int status;
|
int status;
|
||||||
struct stat statBuf;
|
struct stat statBuf;
|
||||||
status=stat(*argv, &statBuf);
|
char buf[NAME_MAX];
|
||||||
|
|
||||||
|
strcpy (buf, *argv);
|
||||||
|
status=stat(buf, &statBuf);
|
||||||
if (status != -1 && status != ENOENT ) {
|
if (status != -1 && status != ENOENT ) {
|
||||||
fprintf(stderr, "%s: File exists\n", *argv);
|
fprintf(stderr, "%s: File exists\n", buf);
|
||||||
exit( FALSE);
|
exit( FALSE);
|
||||||
}
|
}
|
||||||
if (parentFlag == TRUE) {
|
if (parentFlag == TRUE) {
|
||||||
createPath(*argv, mode);
|
strcat( buf, "/");
|
||||||
|
createPath(buf, mode);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (mkdir (*argv, mode) != 0) {
|
if (mkdir (buf, mode) != 0) {
|
||||||
perror(*argv);
|
perror(buf);
|
||||||
exit( FALSE);
|
exit( FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,14 +481,8 @@ extern void createPath (const char *name, int mode)
|
|||||||
char *cpOld;
|
char *cpOld;
|
||||||
char buf[NAME_MAX];
|
char buf[NAME_MAX];
|
||||||
|
|
||||||
strcpy (buf, name);
|
strcpy( buf, name);
|
||||||
if (buf[strlen(buf)]!='/') {
|
|
||||||
buf[strlen(buf)] = '/';
|
|
||||||
buf[strlen(buf)+1] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
cp = strchr (buf, '/');
|
cp = strchr (buf, '/');
|
||||||
|
|
||||||
while (cp) {
|
while (cp) {
|
||||||
cpOld = cp;
|
cpOld = cp;
|
||||||
cp = strchr (cp + 1, '/');
|
cp = strchr (cp + 1, '/');
|
||||||
|
Loading…
Reference in New Issue
Block a user