NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/60033: sockets currently support fstat but not fchown



>Number:         60033
>Category:       kern
>Synopsis:       sockets currently support fstat but not fchown
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 23 17:30:00 +0000 2026
>Originator:     Christos Zoulas
>Release:        NetBSD 11.99.5
>Organization:
	Inconsistencies Unlimited
>Environment:
System: NetBSD quasar.astron.com 11.99.5 NetBSD 11.99.5 (QUASAR) #67: Sun Feb 1 14:39:49 EST 2026 christos%quasar.astron.com@localhost:/usr/src/sys/arch/amd64/compile/QUASAR amd64
Architecture: x86_64
Machine: amd64
>Description:
	Sockets support fstat, but not chown. There is also the question
	of fstat/fchown on local domain sockets (how it should affect
	the filesystem objects they correspond to).
>How-To-Repeat:
#include <sys/socket.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <err.h>


int
main(void)
{
	struct stat st;
	int s = socket(PF_INET, SOCK_STREAM, 0);
	if (s == -1)
		err(EXIT_FAILURE, "socket");
	if (fstat(s, &st) == -1)
		err(EXIT_FAILURE, "fstat");

	printf("uid=%d gid=%d\n", st.st_uid, st.st_gid);
	if (fchown(s, 100, 100) == -1)
		err(EXIT_FAILURE, "fchown");
	if (fstat(s, &st) == -1)
		err(EXIT_FAILURE, "fstat");

	printf("uid=%d gid=%d\n", st.st_uid, st.st_gid);
	return 0;
}
>Fix:
	Add fo_chown to struct fileops?



Home | Main Index | Thread Index | Old Index