Gentoo Archives: gentoo-commits

From: "Samuli Suominen (ssuominen)" <ssuominen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-block/eject/files: eject-2.1.5-man-typo.patch eject-2.1.4-scsi-rdwr.patch eject-2.1.5-toggle.patch eject-2.0.13-xmalloc.patch eject-2.1.5-handle-spaces.patch
Date: Thu, 31 Mar 2011 15:32:02
Message-Id: 20110331153152.6E10720054@flycatcher.gentoo.org
1 ssuominen 11/03/31 15:31:52
2
3 Added: eject-2.1.5-man-typo.patch
4 eject-2.1.4-scsi-rdwr.patch
5 eject-2.1.5-toggle.patch eject-2.0.13-xmalloc.patch
6 eject-2.1.5-handle-spaces.patch
7 Log:
8 Move from sys-apps/eject.
9
10 (Portage version: 2.2.0_alpha29/cvs/Linux x86_64, RepoMan options: --force)
11
12 Revision Changes Path
13 1.1 sys-block/eject/files/eject-2.1.5-man-typo.patch
14
15 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-block/eject/files/eject-2.1.5-man-typo.patch?rev=1.1&view=markup
16 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-block/eject/files/eject-2.1.5-man-typo.patch?rev=1.1&content-type=text/plain
17
18 Index: eject-2.1.5-man-typo.patch
19 ===================================================================
20 http://bugs.gentoo.org/165248
21
22 Index: eject.1
23 ===================================================================
24 RCS file: /cvsroot/eject/eject/eject/eject.1,v
25 retrieving revision 1.5
26 diff -u -p -r1.5 eject.1
27 --- eject.1 11 Dec 2005 00:21:06 -0000 1.5
28 +++ eject.1 4 Feb 2007 23:11:15 -0000
29 @@ -145,7 +145,7 @@ also passes the \-n option to umount(1).
30 .TP 0.5i
31 .B \-m
32 This option allows eject to work with device drivers which automatically
33 -mount removable media and therefore must be always mount()ed.
34 +mount removable media and therefore must be always mount(1)ed.
35 The option tells eject to not try to unmount the given device,
36 even if it is mounted according to /etc/mtab or /proc/mounts.
37
38
39
40
41 1.1 sys-block/eject/files/eject-2.1.4-scsi-rdwr.patch
42
43 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-block/eject/files/eject-2.1.4-scsi-rdwr.patch?rev=1.1&view=markup
44 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-block/eject/files/eject-2.1.4-scsi-rdwr.patch?rev=1.1&content-type=text/plain
45
46 Index: eject-2.1.4-scsi-rdwr.patch
47 ===================================================================
48 http://bugs.gentoo.org/116731
49
50 --- eject-2.0.13/eject.c
51 +++ eject-2.0.13/eject.c
52 @@ -657,7 +657,15 @@
53 /* Open a device file. */
54 static int OpenDevice(const char *fullName)
55 {
56 - int fd = open(fullName, O_RDONLY|O_NONBLOCK);
57 + int flags = O_NONBLOCK;
58 + int fd;
59 +
60 + if (s_option)
61 + flags |= O_RDWR;
62 + else
63 + flags |= O_RDONLY;
64 +
65 + fd = open(fullName, flags);
66 if (fd == -1) {
67 fprintf(stderr, _("%s: unable to open `%s'\n"), programName, fullName);
68 exit(1);
69
70
71
72 1.1 sys-block/eject/files/eject-2.1.5-toggle.patch
73
74 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-block/eject/files/eject-2.1.5-toggle.patch?rev=1.1&view=markup
75 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-block/eject/files/eject-2.1.5-toggle.patch?rev=1.1&content-type=text/plain
76
77 Index: eject-2.1.5-toggle.patch
78 ===================================================================
79 idea take from opensuse
80 http://bugs.gentoo.org/261880
81
82 --- a/eject.c
83 +++ b/eject.c
84 @@ -576,6 +576,21 @@ static void ToggleTray(int fd)
85
86 #ifdef CDROMCLOSETRAY
87
88 + /* Ask the CDROM for info, otherwise fall back to manual */
89 + switch (ioctl(fd, CDROM_DRIVE_STATUS)) {
90 + case CDS_TRAY_OPEN:
91 + CloseTray(fd);
92 + return;
93 +
94 + case CDS_NO_DISC:
95 + case CDS_DISC_OK:
96 + if (ioctl(fd, CDROMEJECT, 0) < 0) {
97 + perror("ioctl");
98 + exit(1);
99 + }
100 + return;
101 + }
102 +
103 /* Try to open the CDROM tray and measure the time therefor
104 * needed. In my experience the function needs less than 0.05
105 * seconds if the tray was already open, and at least 1.5 seconds
106
107
108
109 1.1 sys-block/eject/files/eject-2.0.13-xmalloc.patch
110
111 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-block/eject/files/eject-2.0.13-xmalloc.patch?rev=1.1&view=markup
112 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-block/eject/files/eject-2.0.13-xmalloc.patch?rev=1.1&content-type=text/plain
113
114 Index: eject-2.0.13-xmalloc.patch
115 ===================================================================
116 Make sure the malloc's work.
117
118 http://bugs.gentoo.org/91977
119
120 --- eject.c
121 +++ eject.c
122 @@ -304,2 +304,11 @@
123
124 +void *xmalloc(size_t size)
125 +{
126 + void *ret = malloc(size);
127 + if (!ret) {
128 + fprintf(stderr, _("%s: could not allocate memory\n"), programName);
129 + exit(1);
130 + }
131 + return ret;
132 +}
133
134 @@ -324,3 +333,3 @@
135
136 - buf = (char *) malloc(strlen(name)+14); /* to allow for "/dev/cdroms/ + "0" + null */
137 + buf = (char *) xmalloc(strlen(name)+14); /* to allow for "/dev/cdroms/ + "0" + null */
138
139 @@ -794,3 +803,3 @@
140 if (status == 0) {
141 - result = (char *) malloc(strlen(name) + 25);
142 + result = (char *) xmalloc(strlen(name) + 25);
143 strcpy(result, name);
144
145
146
147 1.1 sys-block/eject/files/eject-2.1.5-handle-spaces.patch
148
149 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-block/eject/files/eject-2.1.5-handle-spaces.patch?rev=1.1&view=markup
150 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-block/eject/files/eject-2.1.5-handle-spaces.patch?rev=1.1&content-type=text/plain
151
152 Index: eject-2.1.5-handle-spaces.patch
153 ===================================================================
154 http://bugs.gentoo.org/151257
155
156 --- eject.c
157 +++ eject.c
158 @@ -370,6 +370,30 @@ static int FileExists(const char *name,
159
160
161 /*
162 + * Linux mangles spaces in mount points by changing them to an octal string
163 + * of '\040'. So lets scan the mount point and fix it up by replacing all
164 + * occurrences off '\0##' with the ASCII value of 0##. Requires a writable
165 + * string as input as we mangle in place. Some of this was taken from the
166 + * util-linux package.
167 + */
168 +#define octalify(a) ((a) & 7)
169 +#define tooctal(s) (64*octalify(s[1]) + 8*octalify(s[2]) + octalify(s[3]))
170 +#define isoctal(a) (((a) & ~7) == '0')
171 +static char *DeMangleMount(char *s)
172 +{
173 + char *tmp = s;
174 + while ((tmp = strchr(tmp, '\\')) != NULL) {
175 + if (isoctal(tmp[1]) && isoctal(tmp[2]) && isoctal(tmp[3])) {
176 + tmp[0] = tooctal(tmp);
177 + memmove(tmp+1, tmp+4, strlen(tmp)-3);
178 + }
179 + ++tmp;
180 + }
181 + return s;
182 +}
183 +
184 +
185 +/*
186 * Given name, such as foo, see if any of the following exist:
187 *
188 * foo (if foo starts with '.' or '/')
189 @@ -884,8 +908,8 @@ static int MountedDevice(const char *nam
190 if (((strcmp(s1, name) == 0) || (strcmp(s2, name) == 0)) ||
191 ((maj != -1) && (maj == mtabmaj) && (min == mtabmin))) {
192 FCLOSE(fp);
193 - *deviceName = strdup(s1);
194 - *mountName = strdup(s2);
195 + *deviceName = DeMangleMount(strdup(s1));
196 + *mountName = DeMangleMount(strdup(s2));
197 return 1;
198 }
199 }
200 @@ -928,8 +952,8 @@ static int MountableDevice(const char *n
201 rc = sscanf(line, "%1023s %1023s", s1, s2);
202 if (rc >= 2 && s1[0] != '#' && strcmp(s2, name) == 0) {
203 FCLOSE(fp);
204 - *deviceName = strdup(s1);
205 - *mountName = strdup(s2);
206 + *deviceName = DeMangleMount(strdup(s1));
207 + *mountName = DeMangleMount(strdup(s2));
208 return 1;
209 }
210 }