summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-05-24 21:43:08 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-05-24 21:43:08 +0000
commite565720aadd79ad42f8bac7a5d9aab1a7ad2e5a7 (patch)
tree788463960ee09cb66c50aa1159b91042773341bf /cpukit
parentaaf60637370acb1db20fb4fe6d0f80752a06f418 (diff)
downloadrtems-e565720aadd79ad42f8bac7a5d9aab1a7ad2e5a7.tar.bz2
2000-05-24 Fernando Ruiz Casas <fernando.ruiz@ctv.es>
* libc/ttyname.c (ttyname_r): Removed duplicate call to closedir(). * libc/getpwent.c: Create a more robust /etc/passwd and /etc/group. * libc/base_fs.c: Change permissions of files and directories. Now uses octal constants.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libcsupport/src/base_fs.c9
-rw-r--r--cpukit/libcsupport/src/getpwent.c12
-rw-r--r--cpukit/libcsupport/src/ttyname.c3
3 files changed, 15 insertions, 9 deletions
diff --git a/cpukit/libcsupport/src/base_fs.c b/cpukit/libcsupport/src/base_fs.c
index 4132d52b6d..7470b52295 100644
--- a/cpukit/libcsupport/src/base_fs.c
+++ b/cpukit/libcsupport/src/base_fs.c
@@ -54,7 +54,8 @@ void rtems_filesystem_initialize( void )
* Set the default umask to "022".
*/
- rtems_filesystem_umask = S_IWOTH | S_IROTH;
+ rtems_filesystem_umask = 022;
+
init_fs_mount_table();
@@ -77,6 +78,7 @@ void rtems_filesystem_initialize( void )
rtems_filesystem_root = entry->mt_fs_root;
rtems_filesystem_current = rtems_filesystem_root;
+
/*
* Traditionally RTEMS devices are under "/dev" so install this directory.
*
@@ -84,8 +86,11 @@ void rtems_filesystem_initialize( void )
*
* NOTE: UNIX root is 755 and owned by root/root (0/0).
*/
+ status=chmod("/", 0755);
+ if ( status != 0 )
+ rtems_fatal_error_occurred( 0xABCD0003 );
- status = mkdir( "/dev", S_IRWXU | S_IRWXG | S_IRWXO );
+ status = mkdir( "/dev", 0777);
if ( status != 0 )
rtems_fatal_error_occurred( 0xABCD0003 );
diff --git a/cpukit/libcsupport/src/getpwent.c b/cpukit/libcsupport/src/getpwent.c
index d749e74f83..7b56e26228 100644
--- a/cpukit/libcsupport/src/getpwent.c
+++ b/cpukit/libcsupport/src/getpwent.c
@@ -57,7 +57,7 @@ void init_etc_passwd_group(void)
return;
etc_passwd_initted = 1;
- (void) mkdir( "/etc", S_IRWXU | S_IRWXG | S_IRWXO );
+ (void) mkdir( "/etc", 0777);
/*
* Initialize /etc/passwd
@@ -66,8 +66,9 @@ void init_etc_passwd_group(void)
if ((fp = fopen ("/etc/passwd", "w")) == NULL)
return;
- fprintf( fp, "root:*:0:0:root,,,,:/tmp:/bin/false\n"
- "rtems:*:1:1:RTEMS Application,,,,:/tmp:/bin/false\n" );
+ fprintf( fp, "root:*:0:0:root,,,,:/:/bin/sh\n"
+ "rtems:*:1:1:RTEMS Application,,,,:/:/bin/sh\n"
+ "tty:!:2:2:tty owner,,,,:/:/bin/false\n" );
fclose( fp );
@@ -78,8 +79,9 @@ void init_etc_passwd_group(void)
if ((fp = fopen ("/etc/group", "w")) == NULL)
return;
- fprintf( fp, "root::0:root\n"
- "rtems::0:rtems\n" );
+ fprintf( fp, "root:x:0:root\n"
+ "rtems:x:1:rtems\n"
+ "tty:x:2:tty\n" );
fclose( fp );
}
diff --git a/cpukit/libcsupport/src/ttyname.c b/cpukit/libcsupport/src/ttyname.c
index 4475267b9c..c649cf06ca 100644
--- a/cpukit/libcsupport/src/ttyname.c
+++ b/cpukit/libcsupport/src/ttyname.c
@@ -39,7 +39,7 @@ int ttyname_r(
set_errno_and_return_minus_one(EBADF);
/* Must be a character device. */
- if (_fstat (fd, &sb) || !S_ISCHR (sb.st_mode))
+ if (fstat (fd, &sb) || !S_ISCHR (sb.st_mode))
set_errno_and_return_minus_one(EBADF);
if ((dp = opendir (_PATH_DEV)) == NULL)
@@ -53,7 +53,6 @@ int ttyname_r(
if (stat (name, &dsb) || sb.st_dev != dsb.st_dev ||
sb.st_ino != dsb.st_ino)
continue;
- (void) closedir (dp);
rval = name;
break;
}