Make newly-created files other than grub.cfg world-readable.

This commit is contained in:
Vladimir Serbinenko 2013-12-24 17:36:10 +01:00
parent 569766e49b
commit e5fa26e573
8 changed files with 12 additions and 8 deletions

View file

@ -1,3 +1,7 @@
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Make newly-created files other than grub.cfg world-readable.
2013-12-24 Andrey Borzenkov <arvidjaar@gmail.com> 2013-12-24 Andrey Borzenkov <arvidjaar@gmail.com>
* util/grub.d/00_header.in: Improve compatibility with old config. * util/grub.d/00_header.in: Improve compatibility with old config.

View file

@ -80,11 +80,11 @@ grub_util_fd_open (const char *os_dev, int flags)
flags |= O_BINARY; flags |= O_BINARY;
#endif #endif
ret = open (os_dev, flags, S_IRUSR | S_IWUSR); ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
/* If we can't have exclusive access, try shared access */ /* If we can't have exclusive access, try shared access */
if (ret < 0) if (ret < 0)
ret = open (os_dev, flags | O_SHLOCK, S_IRUSR | S_IWUSR); ret = open (os_dev, flags | O_SHLOCK, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
return ret; return ret;
} }

View file

@ -180,7 +180,7 @@ grub_util_fd_open (const char *dev, int flg)
if (dev[0] != '/' || dev[1] != '/' || dev[2] != ':') if (dev[0] != '/' || dev[1] != '/' || dev[2] != ':')
{ {
ret->type = GRUB_UTIL_FD_FILE; ret->type = GRUB_UTIL_FD_FILE;
ret->fd = open (dev, flg, S_IRUSR | S_IWUSR); ret->fd = open (dev, flg, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
if (ret->fd < 0) if (ret->fd < 0)
{ {
free (ret); free (ret);

View file

@ -90,7 +90,7 @@ grub_util_fd_open (const char *os_dev, int flags)
flags |= O_BINARY; flags |= O_BINARY;
#endif #endif
ret = open (os_dev, flags, S_IRUSR | S_IWUSR); ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
if (ret >= 0) if (ret >= 0)
configure_device_driver (fd); configure_device_driver (fd);
return ret; return ret;

View file

@ -106,7 +106,7 @@ grub_util_fd_open (const char *os_dev, int flags)
return GRUB_UTIL_FD_INVALID; return GRUB_UTIL_FD_INVALID;
} }
ret = open (os_dev, flags, S_IRUSR | S_IWUSR); ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
if (! (sysctl_oldflags & 0x10) if (! (sysctl_oldflags & 0x10)

View file

@ -181,7 +181,7 @@ grub_util_fd_open (const char *os_dev, int flags)
flags |= O_BINARY; flags |= O_BINARY;
#endif #endif
return open (os_dev, flags, S_IRUSR | S_IWUSR); return open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR);
} }
#endif #endif

View file

@ -68,7 +68,7 @@ grub_util_rename (const char *from, const char *to)
return rename (from, to); return rename (from, to);
} }
#define grub_util_mkdir(a) mkdir (a, 0700) #define grub_util_mkdir(a) mkdir ((a), 0755)
struct grub_util_fd struct grub_util_fd
{ {

View file

@ -71,7 +71,7 @@ grub_util_rename (const char *from, const char *to)
return rename (from, to); return rename (from, to);
} }
#define grub_util_mkdir(a) mkdir ((a), 0700) #define grub_util_mkdir(a) mkdir ((a), 0755)
#if defined (__NetBSD__) #if defined (__NetBSD__)
/* NetBSD uses /boot for its boot block. */ /* NetBSD uses /boot for its boot block. */