Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Nov 2015 00:16:52 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 204207] getsubopt invalid parsing
Message-ID:  <bug-204207-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=204207

            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@FreeBSD.org
          Reporter: temporary.encou@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-204207-8>