* patch for udev and selinux
@ 2004-12-16 14:43 Harald Hoyer
2004-12-16 19:03 ` Kay Sievers
0 siblings, 1 reply; 2+ messages in thread
From: Harald Hoyer @ 2004-12-16 14:43 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 82 bytes --]
Attached patch fixes:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=142713
[-- Attachment #2: udev-039-media.patch --]
[-- Type: text/x-patch, Size: 1293 bytes --]
--- udev-039/selinux.h.media 2004-10-16 00:08:30.000000000 +0200
+++ udev-039/selinux.h 2004-12-14 10:23:37.247464735 +0100
@@ -30,31 +30,40 @@
FILE *fp;
char buf[PATH_MAX];
char mediabuf[PATH_MAX];
+ int ret = -1;
*media = NULL;
if (!(mode && S_IFBLK)) {
return -1;
}
- snprintf(buf,sizeof(buf), "/proc/ide/%s/media", basename(path));
+
+ snprintf(buf, sizeof(buf), "/proc/ide/%s/media", basename(path));
+
fp=fopen(buf,"r");
- if (fp) {
- if (fgets(mediabuf,sizeof(mediabuf), fp)) {
- int size = strlen(mediabuf);
- while (size-- > 0) {
- if (isspace(mediabuf[size])) {
- mediabuf[size]='\0';
- } else {
- break;
- }
- }
- *media = strdup(mediabuf);
- info("selinux_get_media(%s)->%s \n", path, *media);
+ if (!fp)
+ goto out;
+
+ mediabuf[0] = '\0';
+
+ if (fgets(mediabuf, sizeof(mediabuf), fp) == NULL)
+ goto close_out;
+
+ int size = strlen(mediabuf);
+ while (size-- > 0) {
+ if (isspace(mediabuf[size])) {
+ mediabuf[size]='\0';
+ } else {
+ break;
}
- fclose(fp);
- return 0;
- } else {
- return -1;
}
+ *media = strdup(mediabuf);
+ info("selinux_get_media(%s)->%s \n", path, *media);
+ ret = 0;
+
+close_out:
+ fclose(fp);
+out:
+ return ret;
}
static inline void selinux_setfilecon(char *file, unsigned int mode)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: patch for udev and selinux
2004-12-16 14:43 patch for udev and selinux Harald Hoyer
@ 2004-12-16 19:03 ` Kay Sievers
0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2004-12-16 19:03 UTC (permalink / raw)
To: linux-hotplug
On Thu, 2004-12-16 at 15:43 +0100, Harald Hoyer wrote:
> Attached patch fixes:
> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id\x142713
I've applied it to my tree.
Thanks,
Kay
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-12-16 19:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-16 14:43 patch for udev and selinux Harald Hoyer
2004-12-16 19:03 ` Kay Sievers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).