]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - pw/rm_r.c
Convert devd's client socket to type SOCK_SEQPACKET.
[pw-darwin.git] / pw / rm_r.c
index 3394469befd27d75e107310579e33421d4a567a2..797ca9de8827b82f2089642a6942819e5a18153c 100644 (file)
--- a/pw/rm_r.c
+++ b/pw/rm_r.c
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- *
- *     $Id$
  */
 
+#ifndef lint
+static const char rcsid[] =
+  "$FreeBSD$";
+#endif /* not lint */
+
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/param.h>
@@ -48,7 +52,7 @@ rm_r(char const * dir, uid_t uid)
 
                while ((e = readdir(d)) != NULL) {
                        if (strcmp(e->d_name, ".") != 0 && strcmp(e->d_name, "..") != 0) {
-                               sprintf(file, "%s/%s", dir, e->d_name);
+                               snprintf(file, sizeof(file), "%s/%s", dir, e->d_name);
                                if (lstat(file, &st) == 0) {    /* Need symlinks, not
                                                                 * linked file */
                                        if (S_ISDIR(st.st_mode))        /* Directory - recurse */