[BusyBox] Minor problems
Matt Kraai
kraai at alumni.carnegiemellon.edu
Tue Jan 30 03:15:25 UTC 2001
On Mon, Jan 29, 2001 at 05:02:01PM -0800, Larry Doolittle wrote:
> Well, I just built and tested 0.49 on my nanoEngine.
> It has some problems.
>
> 1. The new ls terminal window size code is clueless
> about my situation (remote access via the serial port).
> Instead of defaulting to 80 chars wide, it gives up,
> maybe assuming 0 width. "ls -l" is OK, "ls -w 80" is
> OK, just "ls" does absolutely nothing.
You are right in assuming that the width defaults to zero.
Unfortunately, this ends up causing a divide by zero, which
terminates the process.
> 2. I _think_ I built this copy with USE_SYSTEM_PWD_GRP = true,
> but ls on an NFS mounted directory gives me:
> # ls -l /mnt/recycle
> -rwxrwxr-x 1 ls: unknown uid 501
ls.c uses the my_getpwuid functions from utility.c. I guess it
should be converted to the standard ones now that pwd_grp/ is
included. A patch to fix both 1 and 2 is attached.
Matt
-------------- next part --------------
Index: ls.c
===================================================================
RCS file: /var/cvs/busybox/ls.c,v
retrieving revision 1.58
diff -u -r1.58 ls.c
--- ls.c 2001/01/27 08:24:37 1.58
+++ ls.c 2001/01/30 03:15:44
@@ -64,6 +64,8 @@
#include <fcntl.h>
#include <signal.h>
#include <sys/ioctl.h>
+#include <pwd.h>
+#include <grp.h>
#ifndef NAJOR
#define MAJOR(dev) (((dev)>>8)&0xff)
@@ -173,7 +175,7 @@
static unsigned short column = 0;
#ifdef BB_FEATURE_AUTOWIDTH
-static unsigned short terminal_width;
+static unsigned short terminal_width = 80;
static unsigned short column_width;
static unsigned short tabstops;
#else
@@ -575,6 +577,10 @@
#ifdef BB_FEATURE_LS_FILETYPES
char append;
#endif
+#ifdef BB_FEATURE_LS_USERNAME
+ struct passwd *pw;
+ struct group *grp;
+#endif
if (dn==NULL || dn->fullname==NULL) return(0);
@@ -616,14 +622,14 @@
break;
case LIST_ID_NAME:
#ifdef BB_FEATURE_LS_USERNAME
- my_getpwuid(scratch, dn->dstat.st_uid);
- if (*scratch)
- printf("%-8.8s ", scratch);
+ pw = getpwuid(dn->dstat.st_uid);
+ if (pw != NULL)
+ printf("%-8.8s ", pw->pw_name);
else
printf("%-8d ", dn->dstat.st_uid);
- my_getgrgid(scratch, dn->dstat.st_gid);
- if (*scratch)
- printf("%-8.8s", scratch);
+ grp = getgrgid(dn->dstat.st_gid);
+ if (grp != NULL)
+ printf("%-8.8s", grp->gr_name);
else
printf("%-8d", dn->dstat.st_gid);
column += 17;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20010129/e10731ba/attachment.pgp
More information about the busybox
mailing list