summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/fbset.c2
-rw-r--r--util-linux/fsck_minix.c2
-rw-r--r--util-linux/mkfs_minix.c6
-rw-r--r--util-linux/mkswap.c33
-rw-r--r--util-linux/mount.c8
-rw-r--r--util-linux/nfsmount.c34
-rw-r--r--util-linux/umount.c8
7 files changed, 37 insertions, 56 deletions
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 9fde6a1..2fcc7c2 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -387,7 +387,7 @@ extern int fbset_main(int argc, char **argv)
PERROR("fbset(ioctl)");
if (g_options & OPT_READMODE) {
if (!readmode(&var, modefile, mode)) {
- fprintf(stderr, "Unknown video mode `%s'\n", mode);
+ errorMsg("Unknown video mode `%s'\n", mode);
exit(1);
}
}
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index 685e0ee..74281a7 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -311,7 +311,7 @@ static void show_usage(void)
static void die(const char *str)
{
- fprintf(stderr, "%s: %s\n", applet_name, str);
+ errorMsg("%s\n", str);
leave(8);
}
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index b6f958f..e4dedaf 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -263,7 +263,7 @@ static unsigned long req_nr_inodes = 0;
*/
static volatile void die(char *str)
{
- fprintf(stderr, "%s: %s\n", applet_name, str);
+ errorMsg("%s\n", str);
exit(8);
}
@@ -814,8 +814,8 @@ extern int mkfs_minix_main(int argc, char **argv)
#ifdef HAVE_MINIX2
version2 = 1;
#else
- fprintf(stderr, "%s: not compiled with minix v2 support\n",
- applet_name, device_name);
+ errorMsg("%s: not compiled with minix v2 support\n",
+ device_name);
exit(-1);
#endif
break;
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index 2009636..5a33945 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -116,7 +116,7 @@ static void init_signature_page()
#ifdef PAGE_SIZE
if (pagesize != PAGE_SIZE)
- fprintf(stderr, "Assuming pages of size %d\n", pagesize);
+ errorMsg("Assuming pages of size %d\n", pagesize);
#endif
signature_page = (int *) xmalloc(pagesize);
memset(signature_page, 0, pagesize);
@@ -204,7 +204,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr)
void die(const char *str)
{
- fprintf(stderr, "%s: %s\n", applet_name, str);
+ errorMsg("%s\n", str);
exit(FALSE);
}
@@ -345,18 +345,14 @@ int mkswap_main(int argc, char **argv)
}
}
if (!device_name) {
- fprintf(stderr,
- "%s: error: Nowhere to set up swap on?\n", applet_name);
+ errorMsg("error: Nowhere to set up swap on?\n");
usage(mkswap_usage);
}
sz = get_size(device_name);
if (!PAGES) {
PAGES = sz;
} else if (PAGES > sz && !force) {
- fprintf(stderr,
- "%s: error: "
- "size %ld is larger than device size %d\n",
- applet_name,
+ errorMsg("error: size %ld is larger than device size %d\n",
PAGES * (pagesize / 1024), sz * (pagesize / 1024));
exit(FALSE);
}
@@ -372,14 +368,12 @@ int mkswap_main(int argc, char **argv)
version = 1;
}
if (version != 0 && version != 1) {
- fprintf(stderr, "%s: error: unknown version %d\n",
- applet_name, version);
+ errorMsg("error: unknown version %d\n", version);
usage(mkswap_usage);
}
if (PAGES < 10) {
- fprintf(stderr,
- "%s: error: swap area needs to be at least %ldkB\n",
- applet_name, (long) (10 * pagesize / 1024));
+ errorMsg("error: swap area needs to be at least %ldkB\n",
+ (long) (10 * pagesize / 1024));
usage(mkswap_usage);
}
#if 0
@@ -397,8 +391,8 @@ int mkswap_main(int argc, char **argv)
#endif
if (PAGES > maxpages) {
PAGES = maxpages;
- fprintf(stderr, "%s: warning: truncating swap area to %ldkB\n",
- applet_name, PAGES * pagesize / 1024);
+ errorMsg("warning: truncating swap area to %ldkB\n",
+ PAGES * pagesize / 1024);
}
DEV = open(device_name, O_RDWR);
@@ -424,11 +418,10 @@ int mkswap_main(int argc, char **argv)
for (sum = 0; q >= (unsigned short *) buffer;)
sum ^= *q--;
if (!sum) {
- fprintf(stderr, "\
-%s: Device '%s' contains a valid Sun disklabel.\n\
-This probably means creating v0 swap would destroy your partition table\n\
-No swap created. If you really want to create swap v0 on that device, use\n\
-the -f option to force it.\n", applet_name, device_name);
+ errorMsg("Device '%s' contains a valid Sun disklabel.\n"
+"This probably means creating v0 swap would destroy your partition table\n"
+"No swap created. If you really want to create swap v0 on that device, use\n"
+"the -f option to force it.\n", device_name);
exit(FALSE);
}
}
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 900ab30..455e4a1 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -157,15 +157,15 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
specialfile = find_unused_loop_device();
if (specialfile == NULL) {
- fprintf(stderr, "Could not find a spare loop device\n");
+ errorMsg("Could not find a spare loop device\n");
return (FALSE);
}
if (set_loop(specialfile, lofile, 0, &loro)) {
- fprintf(stderr, "Could not setup loop device\n");
+ errorMsg("Could not setup loop device\n");
return (FALSE);
}
if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */
- fprintf(stderr, "WARNING: loop device is read-only\n");
+ errorMsg("WARNING: loop device is read-only\n");
flags &= ~MS_RDONLY;
}
}
@@ -329,7 +329,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
if (status == FALSE) {
if (whineOnErrors == TRUE) {
- fprintf(stderr, "Mounting %s on %s failed: %s\n",
+ errorMsg("Mounting %s on %s failed: %s\n",
blockDevice, directory, strerror(errno));
}
return (FALSE);
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c
index 8cdfebf..ad0b584 100644
--- a/util-linux/nfsmount.c
+++ b/util-linux/nfsmount.c
@@ -312,8 +312,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
msock = fsock = -1;
mclient = NULL;
if (strlen(spec) >= sizeof(hostdir)) {
- fprintf(stderr, _("mount: "
- "excessively long host:dir argument\n"));
+ errorMsg("excessively long host:dir argument\n");
goto fail;
}
strcpy(hostdir, spec);
@@ -325,12 +324,10 @@ int nfsmount(const char *spec, const char *node, int *flags,
until they can be fully supported. (mack@sgi.com) */
if ((s = strchr(hostdir, ','))) {
*s = '\0';
- fprintf(stderr, _("mount: warning: "
- "multiple hostnames not supported\n"));
+ errorMsg("warning: multiple hostnames not supported\n");
}
} else {
- fprintf(stderr, _("mount: "
- "directory to mount not in host:dir format\n"));
+ errorMsg("directory to mount not in host:dir format\n");
goto fail;
}
@@ -340,13 +337,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
#endif
{
if ((hp = gethostbyname(hostname)) == NULL) {
- fprintf(stderr, _("mount: can't get address for %s\n"),
- hostname);
+ errorMsg("can't get address for %s\n", hostname);
goto fail;
} else {
if (hp->h_length > sizeof(struct in_addr)) {
- fprintf(stderr,
- _("mount: got bad hp->h_length\n"));
+ errorMsg("got bad hp->h_length\n");
hp->h_length = sizeof(struct in_addr);
}
memcpy(&server_addr.sin_addr,
@@ -363,8 +358,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
if (!old_opts)
old_opts = "";
if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
- fprintf(stderr, _("mount: "
- "excessively long option argument\n"));
+ errorMsg("excessively long option argument\n");
goto fail;
}
sprintf(new_opts, "%s%saddr=%s",
@@ -524,11 +518,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
data.flags |= (nolock ? NFS_MOUNT_NONLM : 0);
#endif
if (nfsvers > MAX_NFSPROT) {
- fprintf(stderr, "NFSv%d not supported!\n", nfsvers);
+ errorMsg("NFSv%d not supported!\n", nfsvers);
return 0;
}
if (mountvers > MAX_NFSPROT) {
- fprintf(stderr, "NFSv%d not supported!\n", nfsvers);
+ errorMsg("NFSv%d not supported!\n", nfsvers);
return 0;
}
if (nfsvers && !mountvers)
@@ -588,13 +582,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
} else {
if ((hp = gethostbyname(mounthost)) == NULL) {
- fprintf(stderr, _("mount: can't get address for %s\n"),
- hostname);
+ errorMsg("can't get address for %s\n", hostname);
goto fail;
} else {
if (hp->h_length > sizeof(struct in_addr)) {
- fprintf(stderr,
- _("mount: got bad hp->h_length?\n"));
+ errorMsg("got bad hp->h_length?\n");
hp->h_length = sizeof(struct in_addr);
}
mount_server_addr.sin_family = AF_INET;
@@ -729,8 +721,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
if (nfsvers == 2) {
if (status.nfsv2.fhs_status != 0) {
- fprintf(stderr,
- "mount: %s:%s failed, reason given by server: %s\n",
+ errorMsg("%s:%s failed, reason given by server: %s\n",
hostname, dirname,
nfs_strerror(status.nfsv2.fhs_status));
goto fail;
@@ -748,8 +739,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
#if NFS_MOUNT_VERSION >= 4
fhandle3 *fhandle;
if (status.nfsv3.fhs_status != 0) {
- fprintf(stderr,
- "mount: %s:%s failed, reason given by server: %s\n",
+ errorMsg("%s:%s failed, reason given by server: %s\n",
hostname, dirname,
nfs_strerror(status.nfsv3.fhs_status));
goto fail;
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 59dcb66..1b250fd 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -101,7 +101,7 @@ void mtab_read(void)
return;
if ((fp = setmntent(mtab_file, "r")) == NULL) {
- fprintf(stderr, "Cannot open %s\n", mtab_file);
+ errorMsg("Cannot open %s\n", mtab_file);
return;
}
while ((e = getmntent(fp))) {
@@ -209,11 +209,9 @@ static int do_umount(const char *name, int useMtab)
status = mount(blockDevice, name, NULL,
MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL);
if (status == 0) {
- fprintf(stderr, "umount: %s busy - remounted read-only\n",
- blockDevice);
+ errorMsg("%s busy - remounted read-only\n", blockDevice);
} else {
- fprintf(stderr, "umount: Cannot remount %s read-only\n",
- blockDevice);
+ errorMsg("Cannot remount %s read-only\n", blockDevice);
}
}
if (status == 0) {