Details

[Home]

Issue of the Implementation # S0028

Brief

Implementation of the insque() function does not satisfy POSIX.

Detailed Description

The POSIX description of the insque() function says that "If the queue is to be used as a linear list, invoking insque(&element, NULL), where element is the initial element of the queue, shall initialize the forward and backward pointers of element to null pointers." However this function in the current glibc causes the segmentation fault if the second parameter is NULL.

Problem location(s) in the standard

Linux Standard Base Core Specification 3.1, Chapter 13. Base Libraries, 13.5. Interface Definitions for libc, description of insque() function.

Example

#include <stdio.h>
#include <search.h>
	
typedef struct
{
    void* next;
    void* prev;
} Node;

int main()
{
    Node A;
    A.next = NULL;
    A.prev = NULL;
    insque(&A, NULL);
    return 0;
}

Component

glibc 2.4 or later

Accepted

Red Hat Bugzilla, 2766

Status

Fixed in glibc-2.5

[Home]