Skip to contentSkip to conversation

policycoreutils -- Make restorecon return 0 when a file has changed context with no error

PATCH In review Laurent Bigonville 3 participants 3 messages Mar 26, 2012 – Apr 1, 2012 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 policycoreutils -- Make restorecon return 0 when a file has changed context with no error

Hi,

restorecon should return 0 when a file has changed context with no error. With the last version it's returning 1.

I'm not sure if a patch has already been proposed for this issue.

Laurent

Description: Make restorecon return 0 when a file has changed context with no error
Author: Russell Coker <[email protected]>
Last-Update: 2012-03-07
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=662990

---
 setfiles/restore.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
policycoreutils/setfiles/restore.c +1 -2
index 9a7d315..a378af0 100644
@@ -218,10 +218,9 @@ static int restore(FTSENT *ftsent)
 			r_opts->progname, my_file, newcon, strerror(errno));
 		goto skip;
 	}
-	ret = 1;
 out:
 	freecon(newcon);
-	return ret;
+	return 0;
 skip:
 	freecon(newcon);
 	return SKIP;

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 27 lines · Laurent Bigonville

Hi,

restorecon should return 0 when a file has changed context with no error. With the last version it's returning 1.

I'm not sure if a patch has already been proposed for this issue.

Laurent

Description: Make restorecon return 0 when a file has changed context with no error
Author: Russell Coker <[email protected]>
Last-Update: 2012-03-07
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=662990

---
 setfiles/restore.c |    3 +--

 1 files changed, 1 insertions(+), 2 deletions(-)
policycoreutils/setfiles/restore.c +0 -1
index 9a7d315..a378af0 100644
@@ -218,10 +218,9 @@ static int restore(FTSENT *ftsent)
                        r_opts->progname, my_file, newcon, strerror(errno));
                goto skip;
        }
-       ret = 1;
Quoted 7 lines

 out:
       freecon(newcon);
-       return ret;
+       return 0;
 skip:
       freecon(newcon);
       return SKIP;

Is this right? Don't we get to "out" from a number of error cases? Do we always want 0?

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#2 lore raw
Quoted 30 lines · Eric Paris
Quoted 29 lines · Laurent Bigonville

Hi,

restorecon should return 0 when a file has changed context with no error. With the last version it's returning 1.

I'm not sure if a patch has already been proposed for this issue.

Laurent

Description: Make restorecon return 0 when a file has changed context with no error
Author: Russell Coker <[email protected]>
Last-Update: 2012-03-07
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=662990

---
 setfiles/restore.c |    3 +--

 1 files changed, 1 insertions(+), 2 deletions(-)
policycoreutils/setfiles/restore.c +0 -1
index 9a7d315..a378af0 100644
@@ -218,10 +218,9 @@ static int restore(FTSENT *ftsent)
                        r_opts->progname, my_file, newcon, strerror(errno));
                goto skip;
        }
-       ret = 1;

 out:
       freecon(newcon);

Quoted 8 lines
Quoted 5 lines

-       return ret;
+       return 0;
 skip:
       freecon(newcon);
       return SKIP;

Is this right? Don't we get to "out" from a number of error cases? Do we always want 0?

The return value of 1 when some file context is changed is needed by restorecond.

This patch fixes the same bug:
http://permalink.gmane.org/gmane.comp.security.selinux/16793

Signature · 8 lines
Martin Orr



--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.