Bug#969618: getopt: optarg is NULL outside of loop

2020-09-06 Thread Aurelien Jarno
Hi, On 2020-09-06 09:25, Florian Weimer wrote: > * John Scott: > > > #define _POSIX_C_SOURCE 200809L > > #include > > #include > > #include > > #include > > int main(int argc, char *argv[]) { > > int opt; > > while((opt = getopt(argc, argv, "a:")) != -1) {} > > assert(optarg != NU

Bug#969618: getopt: optarg is NULL outside of loop

2020-09-06 Thread Florian Weimer
* John Scott: > #define _POSIX_C_SOURCE 200809L > #include > #include > #include > #include > int main(int argc, char *argv[]) { > int opt; > while((opt = getopt(argc, argv, "a:")) != -1) {} > assert(optarg != NULL); > } > > If this is invoked as './a.out -afoo', the inner as

Bug#969618: getopt: optarg is NULL outside of loop

2020-09-05 Thread John Scott
Package: libc6 Version: 2.31-3 Severity: normal X-Debbugs-Cc: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 I suspect this is an upstream problem but I'm reporting it here first per their policy [1] since I'm unsure. Both POSIX (including the Issue 8 draft) and the GNU C Library manual say th