Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
65b9e144
Commit
65b9e144
authored
22 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
Define safe_pack_bit_fmt and redefine safe_packstr with max_len for
ease of use in slurmctld
parent
d1b5904d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/pack.h
+28
-2
28 additions, 2 deletions
src/common/pack.h
with
28 additions
and
2 deletions
src/common/pack.h
+
28
−
2
View file @
65b9e144
...
@@ -202,8 +202,34 @@ int unpackmem_array(char *valp, uint32_t size_valp, Buf buffer);
...
@@ -202,8 +202,34 @@ int unpackmem_array(char *valp, uint32_t size_valp, Buf buffer);
goto unpack_error; \
goto unpack_error; \
} while (0)
} while (0)
#define safe_packstr \
#define safe_pack_bit_fmt(bitmap,max_len,buf) do { \
packstr
assert(buf->magic == BUF_MAGIC); \
assert(max_len <= 0xffff); \
if (bitmap) { \
char _tmp_str[max_len]; \
uint32_t _size; \
bit_fmt(_tmp_str,max_len,bitmap); \
_size = strlen(_tmp_str)+1; \
packmem(_tmp_str,(uint16_t)_size,buf); \
} else \
packmem(NULL,(uint16_t)0,buf); \
} while (0)
#define safe_packstr(str,max_len,buf) do { \
uint32_t _size; \
assert(buf->magic == BUF_MAGIC); \
assert(max_len <= 0xffff); \
_size = (str ? strlen(str)+1 : 0); \
assert(_size == 0 || str != NULL); \
if (_size <= max_len) \
packmem(str,(uint16_t)_size,buf); \
else { \
char tmp_str[max_len]; \
strncpy(tmp_str, str, max_len-1); \
tmp_str[max_len - 1] = (char) NULL; \
packmem(tmp_str,(uint16_t)max_len,buf); \
} \
} while (0)
#define packstr(str,buf) do { \
#define packstr(str,buf) do { \
uint32_t _size; \
uint32_t _size; \
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment