Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/ape-chmod-dirbit/chmod.c.orig

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include "lib.h"
#include <errno.h>
#include <stdlib.h>
#include "sys9.h"
#include "dir.h"

int
chmod(const char *path, mode_t mode)
{
	Dir d;

	_nulldir(&d);
	d.mode = mode & 0777;
	if(_dirwstat(path, &d) < 0){
		_syserrno();	
		return -1;
	}
	return 0;
}

int
fchmod(int fd, mode_t mode)
{
	Dir d;

	_nulldir(&d);
	d.mode = mode & 0777;
	if(_dirfwstat(fd, &d) < 0){
		_syserrno();	
		return -1;
	}
	return 0;
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].