Diff for /freem/src/fmadm.c between versions 1.31 and 1.32

version 1.31, 2025/04/04 19:43:18 version 1.32, 2025/04/09 19:52:02
Line 24 Line 24
  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.   *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
  *   *
  *   $Log$   *   $Log$
    *   Revision 1.32  2025/04/09 19:52:02  snw
    *   Eliminate as many warnings as possible while building with -Wall
    *
  *   Revision 1.31  2025/04/04 19:43:18  snw   *   Revision 1.31  2025/04/04 19:43:18  snw
  *   Switch to using environment catalog to determine user and group for environment, and remove -u and -g flags from freem   *   Switch to using environment catalog to determine user and group for environment, and remove -u and -g flags from freem
  *   *
Line 1171  long fm_get_pid (char *env) Line 1174  long fm_get_pid (char *env)
 {  {
     char pid_file[4096];      char pid_file[4096];
     char tmp_pid[255];      char tmp_pid[255];
     long res;  
       
     FILE *fp;      FILE *fp;
   
     snprintf (pid_file, 4095, "%s/freem/run/%s.pid", LOCALSTATEDIR, env);      snprintf (pid_file, 4095, "%s/freem/run/%s.pid", LOCALSTATEDIR, env);
Line 1433  int fm_daemonctl (short action, short ob Line 1434  int fm_daemonctl (short action, short ob
                 case ACT_STATUS:                  case ACT_STATUS:
                     epid = fm_get_pid (cur_env);                      epid = fm_get_pid (cur_env);
                     if (epid > -1) {                      if (epid > -1) {
                         fprintf (stderr, " - %s environment daemon running as pid %d\n", cur_env, epid);                          fprintf (stderr, " - %s environment daemon running as pid %ld\n", cur_env, epid);
                     }                      }
                     else {                      else {
                         fprintf (stderr, " - %s environment daemon does not appear to be running\n", cur_env);                          fprintf (stderr, " - %s environment daemon does not appear to be running\n", cur_env);
Line 1459  void fm_checkperms(void) Line 1460  void fm_checkperms(void)
 void fm_reconfigure(void)  void fm_reconfigure(void)
 {  {
     char config_backup[4096];      char config_backup[4096];
     char vers[4096];  
           
     int retval;         int retval;   
           
Line 1538  void fm_configure (void) Line 1538  void fm_configure (void)
     int reconfigure = FALSE;      int reconfigure = FALSE;
           
     struct stat etcstat;      struct stat etcstat;
     int stat_result;  
   
     DIR *dir;      DIR *dir;
     struct dirent *ent;      struct dirent *ent;
Line 1549  void fm_configure (void) Line 1548  void fm_configure (void)
     char *groupname = env_group;      char *groupname = env_group;
           
 #if !defined(__OS2__)  #if !defined(__OS2__)
       struct group *d_grp;
       struct passwd *d_user;
   
     if (geteuid () != 0) {      if (geteuid () != 0) {
         fprintf (stderr, "fmadm:  not superuser\n");          fprintf (stderr, "fmadm:  not superuser\n");
         exit (1);          exit (1);
     }      }
   
     struct group *d_grp;  
     struct passwd *d_user;  
     gid_t d_gid;  
     uid_t d_uid;  
   
     if ((d_grp = getgrnam (groupname)) == NULL) {      if ((d_grp = getgrnam (groupname)) == NULL) {
         fprintf (stderr, "fmadm:  '%s' group must exist before configuring\n", groupname);          fprintf (stderr, "fmadm:  '%s' group must exist before configuring\n", groupname);
         exit (1);          exit (1);
     }      }
     d_gid = d_grp->gr_gid;  
   
     if ((d_user = getpwnam (username)) == NULL) {      if ((d_user = getpwnam (username)) == NULL) {
         fprintf (stderr, "fmadm:  '%s' user must exist before configuring\n", username);          fprintf (stderr, "fmadm:  '%s' user must exist before configuring\n", username);
         exit (1);          exit (1);
     }      }
     d_uid = d_user->pw_uid;  
 #endif      #endif    
                   
     snprintf (varbase, 4095, "%s/freem", LOCALSTATEDIR);      snprintf (varbase, 4095, "%s/freem", LOCALSTATEDIR);
Line 1778  void fm_configure (void) Line 1772  void fm_configure (void)
         fprintf (stderr, "[OK]\n");          fprintf (stderr, "[OK]\n");
     }      }
     else {      else {
         char modtmp[255];  
           
         fprintf (stderr, "\nUpdating %s: \n", env_config_file);          fprintf (stderr, "\nUpdating %s: \n", env_config_file);
   
         update_conf (env_config_file, fma_environment, "user", env_user);          update_conf (env_config_file, fma_environment, "user", env_user);

Removed from v.1.31  
changed lines
  Added in v.1.32


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>