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.
This commit is contained in:
Joel Sherrill
2001-05-24 21:43:08 +00:00
parent aaf6063737
commit e565720aad
10 changed files with 52 additions and 27 deletions
+7 -2
View File
@@ -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 );
+7 -5
View File
@@ -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 );
}
+1 -2
View File
@@ -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;
}
+7
View File
@@ -1,3 +1,10 @@
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.
2001-05-11 Joel Sherrill <joel@OARcorp.com>
* libc/write.c: Change type of rc to match return type from
+7 -2
View File
@@ -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 );
+7 -5
View File
@@ -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 );
}
+1 -2
View File
@@ -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;
}
+7 -2
View File
@@ -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 );
+7 -5
View File
@@ -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 );
}
+1 -2
View File
@@ -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;
}