|
|
| version 1.31, 2025/04/04 19:43:18 | version 1.34, 2025/04/10 15:31:25 |
|---|---|
| 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.34 2025/04/10 15:31:25 snw | |
| * Attempt to fix DosCopy calls for OS/2 | |
| * | |
| * Revision 1.33 2025/04/10 01:24:38 snw | |
| * Remove C++ style comments | |
| * | |
| * 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 603 int fm_shell (void) | Line 612 int fm_shell (void) |
| char *cmdt = (char *) malloc (65535 * sizeof (char)); | char *cmdt = (char *) malloc (65535 * sizeof (char)); |
| char *result = (char *) malloc (65535 * sizeof (char)); | char *result = (char *) malloc (65535 * sizeof (char)); |
| /* | obj = 0; |
| strcpy (fma_namespace, "SYSTEM"); | |
| set_namespace (fma_namespace, FALSE); | |
| */ | |
| snprintf (fma_prompt, STRLEN - 1, "fmadm [%s]> ", fma_namespace); | snprintf (fma_prompt, STRLEN - 1, "fmadm [%s]> ", fma_namespace); |
| Line 711 int fm_shell (void) | Line 717 int fm_shell (void) |
| i = 0; | i = 0; |
| while ((result = strtok (NULL, " ")) != NULL) { | while ((result = strtok (NULL, " ")) != NULL) { |
| // printf ("%d = %s\n", i, result); | |
| strcpy (args[i++], result); | strcpy (args[i++], result); |
| } | } |
| Line 1171 long fm_get_pid (char *env) | Line 1176 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 1436 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 1462 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 1476 void fm_reconfigure(void) | Line 1478 void fm_reconfigure(void) |
| #if !defined(__OS2__) | #if !defined(__OS2__) |
| retval = cp (config_backup, config_file); | retval = cp (config_backup, config_file); |
| #else | #else |
| retval = DosCopy (config_file, config_backup); | retval = DosCopy (config_file, config_backup, 1); |
| #endif | #endif |
| if (retval == 0) { | if (retval == 0) { |
| Line 1538 void fm_configure (void) | Line 1540 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 1550 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 1774 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); |