public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tomas Hozza <thozza@redhat.com>
To: olaf@aepfle.de, kys@microsoft.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
	apw@canonical.com, jasowang@redhat.com, ben@decadent.org.uk
Cc: Tomas Hozza <thozza@redhat.com>
Subject: [PATCH 3/3] tools/hv: Fix permissions of created directory and files
Date: Fri,  9 Nov 2012 15:01:21 +0100	[thread overview]
Message-ID: <1352469681-4432-3-git-send-email-thozza@redhat.com> (raw)
In-Reply-To: <1352469681-4432-1-git-send-email-thozza@redhat.com>

From: Ben Hutchings <ben@decadent.org.uk>

It's silly to create directories without execute permission, or to
give permissions to 'other' but not the group-owner.

Write the permissions in octal and 'ls -l' format since these are much
easier to read than the named macros.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Tomas Hozza <thozza@redhat.com>
---
 tools/hv/hv_kvp_daemon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 573b9aa..9609858 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -236,7 +236,7 @@ static int kvp_file_init(void)
 	int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK;
 
 	if (access("/var/lib/hyperv", F_OK)) {
-		if (mkdir("/var/lib/hyperv", S_IRUSR | S_IWUSR | S_IROTH)) {
+		if (mkdir("/var/lib/hyperv", 0755 /* rwxr-xr-x */)) {
 			syslog(LOG_ERR, " Failed to create /var/lib/hyperv");
 			exit(EXIT_FAILURE);
 		}
@@ -247,7 +247,7 @@ static int kvp_file_init(void)
 		records_read = 0;
 		num_blocks = 1;
 		sprintf(fname, "/var/lib/hyperv/.kvp_pool_%d", i);
-		fd = open(fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IROTH);
+		fd = open(fname, O_RDWR | O_CREAT, 0644 /* rw-r--r-- */);
 
 		if (fd == -1)
 			return 1;
-- 
1.7.11.7


  parent reply	other threads:[~2012-11-09 14:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-09 14:01 [PATCH 1/3] tools/hv: Fix /var subdirectory Tomas Hozza
2012-11-09 14:01 ` [PATCH 2/3] tools/hv: Fix string types Tomas Hozza
2012-11-09 15:56   ` KY Srinivasan
2012-11-09 14:01 ` Tomas Hozza [this message]
2012-11-09 15:52   ` [PATCH 3/3] tools/hv: Fix permissions of created directory and files KY Srinivasan
2012-11-09 15:57   ` KY Srinivasan
2012-11-09 15:56 ` [PATCH 1/3] tools/hv: Fix /var subdirectory KY Srinivasan
2012-11-12  8:55   ` Tomas Hozza
2012-11-12  8:55     ` [PATCH 3/3] tools/hv: Fix permissions of created directory and files Tomas Hozza
2012-11-26 20:40       ` KY Srinivasan
2012-11-26 20:42     ` [PATCH 1/3] tools/hv: Fix /var subdirectory KY Srinivasan
2012-11-26 21:12       ` gregkh
2012-11-26 21:15         ` KY Srinivasan
2012-11-27  7:56           ` [PATCH 1/3] tools/hv: Fix for long file names from readdir Tomas Hozza
2012-11-27  7:56             ` [PATCH 2/3] tools/hv: Fix /var subdirectory Tomas Hozza
2012-11-27 13:59               ` KY Srinivasan
2012-11-27  7:56             ` [PATCH 3/3] tools/hv: Fix permissions of created directory and files Tomas Hozza
2012-11-27 13:59               ` KY Srinivasan
2012-11-27 13:58             ` [PATCH 1/3] tools/hv: Fix for long file names from readdir KY Srinivasan
2012-11-27 14:50             ` Ben Hutchings
2012-11-27 20:28               ` Tomas Hozza
2012-11-27 20:41                 ` Ben Hutchings
2012-12-18  8:06                   ` Tomas Hozza
2012-12-18 12:38                     ` Ben Hutchings
2013-01-17 18:41                       ` Greg KH
2012-11-15 23:38   ` [PATCH 1/3] tools/hv: Fix /var subdirectory gregkh
2012-11-15 23:52     ` KY Srinivasan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1352469681-4432-3-git-send-email-thozza@redhat.com \
    --to=thozza@redhat.com \
    --cc=apw@canonical.com \
    --cc=ben@decadent.org.uk \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jasowang@redhat.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@aepfle.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox