aboutsummaryrefslogtreecommitdiff
path: root/sysutils/eject
diff options
context:
space:
mode:
authorEdwin Groothuis <edwin@FreeBSD.org>2003-09-29 14:19:15 +0000
committerEdwin Groothuis <edwin@FreeBSD.org>2003-09-29 14:19:15 +0000
commitc8900826adabc76172fb041807c4d679f61de0fd (patch)
treecaa0ea5b77b162969e6d8d6fb54f53dc16de7647 /sysutils/eject
parent2dff7a83844a346ecbafa3b1c086bec4763abfe5 (diff)
Notes
Diffstat (limited to 'sysutils/eject')
-rw-r--r--sysutils/eject/Makefile1
-rw-r--r--sysutils/eject/files/patch-aa44
2 files changed, 33 insertions, 12 deletions
diff --git a/sysutils/eject/Makefile b/sysutils/eject/Makefile
index 105d60fdab95..2cdc52b7e065 100644
--- a/sysutils/eject/Makefile
+++ b/sysutils/eject/Makefile
@@ -7,6 +7,7 @@
PORTNAME= eject
PORTVERSION= 1.4
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= ftp://ports.jp.FreeBSD.org/pub/FreeBSD-jp/OD/ \
ftp://ftp4.jp.FreeBSD.org/pub/FreeBSD-jp/OD/ \
diff --git a/sysutils/eject/files/patch-aa b/sysutils/eject/files/patch-aa
index 20f9b91515ae..a80b8055837b 100644
--- a/sysutils/eject/files/patch-aa
+++ b/sysutils/eject/files/patch-aa
@@ -1,5 +1,5 @@
---- eject.c.orig Tue Jan 4 23:42:12 2000
-+++ eject.c Fri Apr 20 22:10:06 2001
+--- eject.c.orig Tue Jan 4 06:42:12 2000
++++ eject.c Mon Sep 29 07:16:58 2003
@@ -43,8 +43,8 @@
extern int optind;
@@ -22,7 +22,7 @@
char *defdev;
fflag = nflag = vflag = 0;
-@@ -95,18 +95,18 @@
+@@ -95,18 +95,27 @@
if (argc == 0) {
usage();
}
@@ -38,6 +38,15 @@
if (sts < 0) {
perror(program);
exit(1);
++ } else {
++ int c;
++ char *dev_bak = malloc(MAXPATHLEN);
++ if (c = readlink(device, dev_bak, MAXPATHLEN)) {
++ dev_bak[c] = '\0';
++ name = dev_bak;
++ } else {
++ free(dev_bak);
++ }
}
- sts = unmount_fs(name, err);
@@ -45,29 +54,40 @@
if (sts < 0) {
perror(err);
exit(1);
-@@ -128,16 +128,17 @@
+@@ -128,16 +137,26 @@
int
check_device(name, device)
char *name;
- char *device;
+ char **device;
{
- int sts;
+- int sts;
++ int sts, i;
struct stat sb;
- sprintf(device, "/dev/r%sc", name);
-+ if (asprintf(device, "/dev/%sc", name) == -1)
-+ return sts;
- if (vflag || nflag) {
+- if (vflag || nflag) {
- printf("%s: using device %s\n", program, device);
-+ printf("%s: using device %s\n", program, *device);
++ const char* dev_list[] = { "/dev/%sc", "/dev/%s", "%s" };
++ for (i = 0; i < 2; i++) {
++ if (asprintf(device, dev_list[i], name) == -1)
++ return sts;
++ if (vflag || nflag) {
++ printf("%s: trying device %s\n", program, *device);
++ }
++ sts = stat(*device, &sb);
++ if (sts) { /* stat failed, try next */
++ free(*device);
++ continue;
++ } else {
++ break;
++ }
}
- sts = stat(device, &sb);
-+ sts = stat(*device, &sb);
return sts;
}
-@@ -155,7 +156,7 @@
+@@ -155,7 +174,7 @@
int
unmount_fs(name, err)
char *name;
@@ -76,7 +96,7 @@
{
int mnts;
struct statfs *mntbuf;
-@@ -221,7 +222,7 @@
+@@ -221,7 +240,7 @@
sts = 0;
}
if (sts < 0 && fflag == 0) {