diff options
author | pav <pav@FreeBSD.org> | 2005-07-20 04:48:26 +0800 |
---|---|---|
committer | pav <pav@FreeBSD.org> | 2005-07-20 04:48:26 +0800 |
commit | a6bb4dbf65bd81820b4d96722b8fa38abe0097b1 (patch) | |
tree | 02c65b95a4fd98d3fcb0862849e1e55e285d4659 /sysutils/eject | |
parent | d48f472b8c7154437b8492326c6f9a7d5ad9e398 (diff) | |
download | freebsd-ports-gnome-a6bb4dbf65bd81820b4d96722b8fa38abe0097b1.tar.gz freebsd-ports-gnome-a6bb4dbf65bd81820b4d96722b8fa38abe0097b1.tar.zst freebsd-ports-gnome-a6bb4dbf65bd81820b4d96722b8fa38abe0097b1.zip |
- Teach eject to recognize full device node pathnames too
PR: ports/83719
Submitted by: Stefan Sperling <stsp@stsp.in-berlin.de>
Approved by: Sylvio Cesar <sylvioc@gmail.com> (maintainer)
Diffstat (limited to 'sysutils/eject')
-rw-r--r-- | sysutils/eject/Makefile | 2 | ||||
-rw-r--r-- | sysutils/eject/files/patch-eject.1 | 16 | ||||
-rw-r--r-- | sysutils/eject/files/patch-eject.c | 48 |
3 files changed, 60 insertions, 6 deletions
diff --git a/sysutils/eject/Makefile b/sysutils/eject/Makefile index 7810a0a5f9a1..6e615a797ce2 100644 --- a/sysutils/eject/Makefile +++ b/sysutils/eject/Makefile @@ -7,7 +7,7 @@ PORTNAME= eject PORTVERSION= 1.5 -PORTREVISION= 1 +PORTREVISION= 2 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-eject.1 b/sysutils/eject/files/patch-eject.1 new file mode 100644 index 000000000000..6f633fa6eca9 --- /dev/null +++ b/sysutils/eject/files/patch-eject.1 @@ -0,0 +1,16 @@ +--- eject.1.orig Tue Jul 19 13:43:50 2005 ++++ eject.1 Tue Jul 19 13:26:55 2005 +@@ -39,7 +39,12 @@ + is a program to eject removable media from drive. + The + .Ar device +-is a removable drive name such as cd0, matcd0, mcd0, scd0, wcd0 or od0. ++is a removable drive name such as cd0, matcd0, mcd0, scd0, wcd0 or od0. ++For compatiblity reasons, the string ++.Dq Li /dev/ ++may optionally be prepended to ++.Ar device . ++ + .Nm eject + unmounts the + .Ar device diff --git a/sysutils/eject/files/patch-eject.c b/sysutils/eject/files/patch-eject.c index 0f1efac8fed0..18990fe3a9e4 100644 --- a/sysutils/eject/files/patch-eject.c +++ b/sysutils/eject/files/patch-eject.c @@ -1,11 +1,49 @@ ---- eject.c.orig Tue May 3 14:59:19 2005 -+++ eject.c Tue May 3 15:01:30 2005 -@@ -133,7 +133,7 @@ +--- eject.c.orig Tue Jul 19 13:43:37 2005 ++++ eject.c Tue Jul 19 14:14:24 2005 +@@ -122,7 +122,7 @@ + } + + /* +- * check device is exists. ++ * check whether device exists. + */ + + int +@@ -133,8 +133,14 @@ int sts; struct stat sb; - if (asprintf(device, "/dev/%sc", name) == -1) -+ if (asprintf(device, "/dev/%s", name) == -1) - return sts; +- return sts; ++ if (strncmp("/dev/", name, strlen("/dev/")) == 0) { ++ if (asprintf(device, "%s", name) == -1) ++ return sts; ++ } ++ else { ++ if (asprintf(device, "/dev/%s", name) == -1) ++ return sts; ++ } if (vflag || nflag) { printf("%s: using device %s\n", program, device); + } +@@ -174,11 +180,16 @@ + /* get proper mount information into the list */ + len = strlen(name); + for (n = 0; n < mnts; n++) { +- p = rindex(mntbuf[n].f_mntfromname, '/'); +- if (p == NULL) { +- continue; ++ if (strncmp("/dev/", name, strlen("/dev/")) == 0) ++ p = mntbuf[n].f_mntfromname; ++ else { ++ p = rindex(mntbuf[n].f_mntfromname, '/'); ++ if (p == NULL) ++ continue; ++ ++p; + } +- for (i = 0, ++p, q = name; *p != '\0' && *q != '\0'; ++i, ++p, ++q) { ++ ++ for (i = 0, p, q = name; *p != '\0' && *q != '\0'; ++i, ++p, ++q) { + if (*p != *q) { + break; + } |