Skip to content

Always initialize file descriptor in OS_OpenCreate #833

@skliper

Description

@skliper

Is your feature request related to a problem? Please describe.
Numerous false alarms on possible uninitialized variable with OS_OpenCreate use.

Describe the solution you'd like
Initialize the file descriptor to OS_OBJECT_ID_UNDEFINED:

int32 OS_OpenCreate(osal_id_t *filedes, const char *path, int32 flags, int32 access)
{
int32 return_code;
char local_path[OS_MAX_LOCAL_PATH_LEN];
OS_object_token_t token;
OS_stream_internal_record_t *stream;
/* Check parameters */
OS_CHECK_POINTER(filedes);

Describe alternatives you've considered
Could initialize before passing in from each call, but this would provide consistency

Additional context
Static analysis warnings (on use)

Requester Info
Jacob Hageman - NASA/GSFC

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions