From 094ca96844842928810f14844413109fc6cdd890 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 3 Feb 2013 00:59:38 -0700 Subject: Initial Alpine Version --- pith/osdep/creatdir.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 pith/osdep/creatdir.c (limited to 'pith/osdep/creatdir.c') diff --git a/pith/osdep/creatdir.c b/pith/osdep/creatdir.c new file mode 100644 index 00000000..bc15da21 --- /dev/null +++ b/pith/osdep/creatdir.c @@ -0,0 +1,55 @@ +#if !defined(lint) && !defined(DOS) +static char rcsid[] = "$Id: creatdir.c 769 2007-10-24 00:15:40Z hubert@u.washington.edu $"; +#endif + +/* + * ======================================================================== + * Copyright 2006-2007 University of Washington + * Copyright 2013 Eduardo Chappa + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * ======================================================================== + */ + +#include +#include "../charconv/utf8.h" +#include "../charconv/filesys.h" +#include "creatdir.h" + + +#ifdef S_IRWXU +#define MAILDIR_MODE S_IRWXU +#else +#define MAILDIR_MODE 0700 +#endif + + + +/*---------------------------------------------------------------------- + Create the mail subdirectory. + + Args: dir -- Name of the directory to create + + Result: Directory is created. Returns 0 on success, else -1 on error + and errno is valid. + ----*/ +int +create_mail_dir(char *dir) +{ + if(our_mkdir(dir, MAILDIR_MODE) < 0) + return(-1); + +#ifndef _WINDOWS + our_chmod(dir, MAILDIR_MODE); + + /* Some systems need this, on others we don't care if it fails */ + our_chown(dir, getuid(), getgid()); +#endif /* !_WINDOWS */ + + return(0); +} -- cgit v1.2.3-54-g00ecf