-/* $OpenBSD: sftp-server.c,v 1.84 2008/06/26 06:10:09 djm Exp $ */
+/* $OpenBSD: sftp-server.c,v 1.88 2009/10/17 12:10:39 sobrado Exp $ */
/*
* Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
*
else if (S_ISREG(sb.st_mode)) {
/* Race-free rename of regular files */
if (link(oldpath, newpath) == -1) {
- if (errno == EOPNOTSUPP
+ if (errno == EOPNOTSUPP || errno == ENOSYS
+#ifdef EXDEV
+ || errno == EXDEV
+#endif
#ifdef LINK_OPNOTSUPP_ERRNO
|| errno == LINK_OPNOTSUPP_ERRNO
#endif
extern char *__progname;
fprintf(stderr,
- "usage: %s [-he] [-l log_level] [-f log_facility]\n", __progname);
+ "usage: %s [-eh] [-f log_facility] [-l log_level] [-u umask]\n",
+ __progname);
exit(1);
}
ssize_t len, olen, set_size;
SyslogFacility log_facility = SYSLOG_FACILITY_AUTH;
char *cp, buf[4*4096];
+ const char *errmsg;
+ mode_t mask;
extern char *optarg;
extern char *__progname;
__progname = ssh_get_progname(argv[0]);
log_init(__progname, log_level, log_facility, log_stderr);
- while (!skipargs && (ch = getopt(argc, argv, "C:f:l:che")) != -1) {
+ while (!skipargs && (ch = getopt(argc, argv, "f:l:u:che")) != -1) {
switch (ch) {
case 'c':
/*
if (log_facility == SYSLOG_FACILITY_NOT_SET)
error("Invalid log facility \"%s\"", optarg);
break;
+ case 'u':
+ mask = (mode_t)strtonum(optarg, 0, 0777, &errmsg);
+ if (errmsg != NULL)
+ fatal("Invalid umask \"%s\": %s",
+ optarg, errmsg);
+ (void)umask(mask);
+ break;
case 'h':
default:
sftp_server_usage();