[Bug 204207] getsubopt invalid parsing

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Nov 2 00:16:52 UTC 2015


            Bug ID: 204207
           Summary: getsubopt invalid parsing
           Product: Base System
           Version: 9.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: temporary.encou at gmail.com

Following code will have invalid output.

#include <stdio.h>
#include <stdlib.h>

int main()
    char text[] = "text=1 2";
    char* subopts = text;
    char* line_subopts[] = {"text", 0};
    char* subopt_value;
    int opt = ::getsubopt(&subopts, line_subopts, &subopt_value);
    printf("%d, %s\n", opt, subopt_value);
    return 0;

$ clang++ bug.cpp
$ ./a.out
0, 1

Same thing happens with g++. I've tried on other platforms and it correctly
outputs "0, 1 2"

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-bugs mailing list