summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--fdisk/cfdisk.c12
-rw-r--r--fdisk/fdiskbsdlabel.c2
-rw-r--r--getopt/Makefile.am2
-rw-r--r--login-utils/agetty.c28
-rw-r--r--login-utils/wall.c8
-rw-r--r--misc-utils/namei.c19
-rw-r--r--mount/lomount.c1
-rw-r--r--mount/swapon.c34
9 files changed, 67 insertions, 40 deletions
diff --git a/configure.ac b/configure.ac
index dacc7962..ed12e60b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,7 @@ AC_CHECK_FUNCS(
[inet_aton \
fsync \
getdomainname \
+ get_current_dir_name \
nanosleep \
personality \
updwtmp \
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c
index 7ed11ea1..0c341bd4 100644
--- a/fdisk/cfdisk.c
+++ b/fdisk/cfdisk.c
@@ -181,8 +181,6 @@ int pt_heads = 0, pt_sectors = 0;
static void
set_hsc0(unsigned char *h, unsigned char *s, int *c, long long sector) {
- if (sector >= 1024*cylinder_size)
- sector = 1024*cylinder_size - 1;
*s = sector % sectors + 1;
sector /= sectors;
*h = sector % heads;
@@ -195,6 +193,8 @@ set_hsc(unsigned char *h, unsigned char *s, unsigned char *c,
long long sector) {
int cc;
+ if (sector >= 1024*cylinder_size)
+ sector = 1024*cylinder_size - 1;
set_hsc0(h, s, &cc, sector);
*c = cc & 0xFF;
*s |= (cc >> 2) & 0xC0;
@@ -2164,7 +2164,7 @@ print_part_entry(FILE *fp, int num, partition_info *pi) {
set_hsc0(&eh, &es, &ec, end);
}
- fp_printf(fp, "%2d 0x%02X %4d %4d %4d 0x%02X %4d %4d %4d %11lld %11lld\n",
+ fp_printf(fp, "%2d 0x%02X %4d %4d %5d 0x%02X %4d %4d %5d %11lld %11lld\n",
num+1, flags, sh, ss, sc, id, eh, es, ec, first, size);
}
@@ -2202,9 +2202,9 @@ print_part_table(void) {
fp_printf(fp, _("Partition Table for %s\n"), disk_device);
fp_printf(fp, "\n");
/* Three-line heading. Read "Start Sector" etc vertically. */
- fp_printf(fp, _(" ---Starting--- ----Ending---- Start Number of\n"));
- fp_printf(fp, _(" # Flags Head Sect Cyl ID Head Sect Cyl Sector Sectors\n"));
- fp_printf(fp, _("-- ----- ---- ---- ---- ---- ---- ---- ---- ----------- -----------\n"));
+ fp_printf(fp, _(" ---Starting---- ----Ending----- Start Number of\n"));
+ fp_printf(fp, _(" # Flags Head Sect Cyl ID Head Sect Cyl Sector Sectors\n"));
+ fp_printf(fp, _("-- ----- ---- ---- ----- ---- ---- ---- ----- ----------- -----------\n"));
for (i = 0; i < 4; i++) {
for (j = 0;
diff --git a/fdisk/fdiskbsdlabel.c b/fdisk/fdiskbsdlabel.c
index 01912ab5..377b64ec 100644
--- a/fdisk/fdiskbsdlabel.c
+++ b/fdisk/fdiskbsdlabel.c
@@ -515,7 +515,7 @@ static void
xbsd_write_bootstrap (void)
{
char *bootdir = BSD_LINUX_BOOTDIR;
- char path[MAXPATHLEN];
+ char path[sizeof(BSD_LINUX_BOOTDIR) + 1 + 2 + 4]; /* BSD_LINUX_BOOTDIR + / + {sd,wd} + boot */
char *dkbasename;
struct xbsd_disklabel dl;
char *d, *p, *e;
diff --git a/getopt/Makefile.am b/getopt/Makefile.am
index 0af048d9..03388421 100644
--- a/getopt/Makefile.am
+++ b/getopt/Makefile.am
@@ -7,7 +7,7 @@ getopt_CPPFLAGS = -DLIBCGETOPT=1 $(AM_CPPFLAGS)
man_MANS = getopt.1
exampledir = $(datadir)/getopt/
-dist_example_DATA = getopt-parse.bash getopt-parse.tcsh \
+dist_example_SCRIPTS = getopt-parse.bash getopt-parse.tcsh \
getopt-test.bash getopt-test.tcsh
EXTRA_DIST = README Changelog COPYING
diff --git a/login-utils/agetty.c b/login-utils/agetty.c
index 6640cf2b..cbae0923 100644
--- a/login-utils/agetty.c
+++ b/login-utils/agetty.c
@@ -116,22 +116,12 @@
#define TCSETAW TCSETSW
#endif
- /*
- * This program tries to not use the standard-i/o library. This keeps the
- * executable small on systems that do not have shared libraries (System V
- * Release <3).
- */
-#ifndef BUFSIZ
-#define BUFSIZ 1024
-#endif
-
-/* set a maximum length for the hostname, */
-#ifdef HOST_NAME_MAX
-# define HOSTNAME_LENGTH HOST_NAME_MAX /* defined by POSIX.1 */
-#elif defined(MAXHOSTNAMELEN)
-# define HOSTNAME_LENGTH MAXHOSTNAMELEN /* implemented in current Unix-versions */
-#else
-# define HOSTNAME_LENGTH 255
+#ifndef MAXHOSTNAMELEN
+# ifdef HOST_NAME_MAX
+# define MAXHOSTNAMELEN HOST_NAME_MAX
+# else
+# define MAXHOSTNAMELEN 64
+# endif
#endif
/*
@@ -884,7 +874,7 @@ do_prompt(op, tp)
case 'o':
{
- char domainname[HOST_NAME_MAX+1];
+ char domainname[MAXHOSTNAMELEN+1];
#ifdef HAVE_GETDOMAINNAME
if (getdomainname(domainname, sizeof(domainname)))
#endif
@@ -897,7 +887,7 @@ do_prompt(op, tp)
case 'O':
{
char *dom = "unknown_domain";
- char host[HOST_NAME_MAX + 1];
+ char host[MAXHOSTNAMELEN+1];
struct addrinfo hints, *info = NULL;
memset(&hints, 0, sizeof(hints));
@@ -992,7 +982,7 @@ do_prompt(op, tp)
}
#endif
{
- char hn[HOST_NAME_MAX+1];
+ char hn[MAXHOSTNAMELEN+1];
if (gethostname(hn, sizeof(hn)) == 0)
write(1, hn, strlen(hn));
}
diff --git a/login-utils/wall.c b/login-utils/wall.c
index c9893d7e..42856ae3 100644
--- a/login-utils/wall.c
+++ b/login-utils/wall.c
@@ -67,6 +67,14 @@ void makemsg __P((char *));
#define IGNOREUSER "sleeper"
+#ifndef MAXHOSTNAMELEN
+# ifdef HOST_NAME_MAX
+# define MAXHOSTNAMELEN HOST_NAME_MAX
+# else
+# define MAXHOSTNAMELEN 64
+# endif
+#endif
+
int nobanner;
int mbufsize;
char *mbuf;
diff --git a/misc-utils/namei.c b/misc-utils/namei.c
index 0db176a6..e8f7a8bd 100644
--- a/misc-utils/namei.c
+++ b/misc-utils/namei.c
@@ -73,6 +73,10 @@ int xflag = 0;
#define MAXSYMLINKS 256
#endif
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
static char *pperm(unsigned short);
static void namei(char *, int, mode_t *);
static void usage(void);
@@ -81,7 +85,11 @@ int
main(int argc, char **argv) {
extern int optind;
int c;
- char curdir[MAXPATHLEN];
+#ifdef HAVE_GET_CURRENT_DIR_NAME
+ char *curdir;
+#else
+ char curdir[PATH_MAX];
+#endif
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
@@ -106,7 +114,12 @@ main(int argc, char **argv) {
}
}
- if(getcwd(curdir, sizeof(curdir)) == NULL){
+#ifdef HAVE_GET_CURRENT_DIR_NAME
+ if (!(curdir = get_current_dir_name()))
+#else
+ if(getcwd(curdir, sizeof(curdir)) == NULL)
+#endif
+ {
(void)fprintf(stderr,
_("namei: unable to get current directory - %s\n"),
curdir);
@@ -140,8 +153,6 @@ usage(void) {
#define NODEV (dev_t)(-1)
#endif
-int kzak;
-
static void
namei(char *file, int lev, mode_t *lastmode) {
char *cp;
diff --git a/mount/lomount.c b/mount/lomount.c
index 74c6f680..c140c159 100644
--- a/mount/lomount.c
+++ b/mount/lomount.c
@@ -397,6 +397,7 @@ set_loop(const char *device, const char *file, unsigned long long offset,
}
if ((fd = open(device, mode)) < 0) {
perror (device);
+ close(ffd);
return 1;
}
*loopro = (mode == O_RDONLY);
diff --git a/mount/swapon.c b/mount/swapon.c
index ce3597e5..6c2c4866 100644
--- a/mount/swapon.c
+++ b/mount/swapon.c
@@ -58,22 +58,38 @@ static struct option *longswapoffopts = &longswaponopts[2];
static int cannot_find(const char *special);
+#define PRINT_USAGE_SPECIAL(_fp) \
+ fprintf(_fp, _( \
+ "Special parameter:\n" \
+ " {-L label | LABEL=label} volume LABEL\n" \
+ " {-U uuid | UUID=uuid} volume UUID\n" \
+ " <file> swap file\n" \
+ " <device> swap device\n\n"))
+
static void
swapon_usage(FILE *fp, int n) {
- fprintf(fp, _("usage: %1$s [-hV]\n"
- " %1$s -a [-e] [-v]\n"
- " %1$s [-v] [-p priority] special|LABEL=volume_name ...\n"
- " %1$s [-s]\n"),
- progname);
+ fprintf(fp, _("\nUsage:\n"
+ " %1$s -a [-e] [-v] enable all swaps from /etc/fstab\n"
+ " %1$s [-v] [-p priority] <special> enable swap\n"
+ " %1$s [-s] display swap usage summary\n"
+ " %1$s [-h] display help\n"
+ " %1$s [-V] display version\n\n"), progname);
+
+ PRINT_USAGE_SPECIAL(fp);
+
exit(n);
}
static void
swapoff_usage(FILE *fp, int n) {
- fprintf(fp, _("usage: %1$s [-hV]\n"
- " %1$s -a [-v]\n"
- " %1$s [-v] special ...\n"),
- progname);
+ fprintf(fp, _("\nUsage:\n"
+ " %1$s -a [-v] disable all swaps\n"
+ " %1$s [-v] <special> disable given swap\n"
+ " %1$s [-h] display help\n"
+ " %1$s [-V] display version\n\n"), progname);
+
+ PRINT_USAGE_SPECIAL(fp);
+
exit(n);
}