Exemple #1
0
static void rtems_shell_init_issue(void)
{
  static bool issue_inited=false;
  struct stat buf;

  if (issue_inited)
    return;
  issue_inited = true;

  /* dummy call to init /etc dir */
  getpwnam("root");

  if (stat("/etc/issue",&buf)) {
    rtems_shell_write_file("/etc/issue",
                           "\n"
                           "Welcome to @V\\n"
                           "Login into @S\\n");
  }

  if (stat("/etc/issue.net",&buf)) {
     rtems_shell_write_file("/etc/issue.net",
                           "\n"
                            "Welcome to %v\n"
                            "running on %m\n");
  }
}
Exemple #2
0
static void writeFile(
  const char *name,
  mode_t      mode,
  const char *contents
)
{
  int sc;
  sc = setuid(0);
  if ( sc ) {
    printf( "setuid failed: %s: %s\n", name, strerror(errno) );
  }

  rtems_shell_write_file( name, contents );

  sc = chmod ( name, mode );
  if ( sc ) {
    printf( "chmod %s: %s\n", name, strerror(errno) );
  }
}