Skip to content
Snippets Groups Projects
Commit c0cb1750 authored by Moe Jette's avatar Moe Jette
Browse files

Change default node tmp_disk size to zero (for diskless nodes).

Change hostname logic to use uname() rather than gethostname() and permit
    hostnames to contain ".".
parent 67d6b98c
No related branches found
No related tags found
No related merge requests found
......@@ -42,14 +42,15 @@
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <pthread.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <time.h>
#include <unistd.h>
#include <pthread.h>
#include <slurm/slurm.h>
......@@ -347,7 +348,7 @@ static int parse_nodename(void **dest, slurm_parser_enum_t type,
if (!s_p_get_uint32(&n->tmp_disk, "TmpDisk", tbl)
&& !s_p_get_uint32(&n->tmp_disk, "TmpDisk", dflt))
n->tmp_disk = 1;
n->tmp_disk = 0;
if (!s_p_get_uint32(&n->weight, "Weight", tbl)
&& !s_p_get_uint32(&n->weight, "Weight", dflt))
......@@ -1010,27 +1011,18 @@ extern int slurm_conf_get_cpus_sct(const char *node_name,
* (e.g. "linux123.foo.bar" becomes "linux123")
* OUT name
*/
int
extern int
gethostname_short (char *name, size_t len)
{
int error_code, name_len;
char *dot_ptr, path_name[1024];
struct utsname buf;
error_code = gethostname (path_name, sizeof(path_name));
if (error_code)
return error_code;
dot_ptr = strchr (path_name, '.');
if (dot_ptr == NULL)
dot_ptr = path_name + strlen(path_name);
else
dot_ptr[0] = '\0';
if (uname(&buf))
return errno;
name_len = (dot_ptr - path_name);
if (name_len > len)
if (strlen(buf.nodename) >= len)
return ENAMETOOLONG;
strcpy (name, path_name);
strcpy(name, buf.nodename);
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment