Cleanup uses of sprintf, add modes to open() with O_CREAT.

Change-Id: Iaed2538831b19ada26005bbef33cff28209c6512
diff --git a/Process.cpp b/Process.cpp
index 962a460..7dc0144 100644
--- a/Process.cpp
+++ b/Process.cpp
@@ -85,7 +85,7 @@
 
     // compute path to process's directory of open files
     char    path[PATH_MAX];
-    sprintf(path, "/proc/%d/fd", pid);
+    snprintf(path, sizeof(path), "/proc/%d/fd", pid);
     DIR *dir = opendir(path);
     if (!dir)
         return 0;
@@ -129,7 +129,7 @@
     FILE *file;
     char buffer[PATH_MAX + 100];
 
-    sprintf(buffer, "/proc/%d/maps", pid);
+    snprintf(buffer, sizeof(buffer), "/proc/%d/maps", pid);
     file = fopen(buffer, "r");
     if (!file)
         return 0;
@@ -155,7 +155,7 @@
     char    path[PATH_MAX];
     char    link[PATH_MAX];
 
-    sprintf(path, "/proc/%d/%s", pid, name);
+    snprintf(path, sizeof(path), "/proc/%d/%s", pid, name);
     if (readSymLink(path, link, sizeof(link)) && pathMatchesMountPoint(link, mountPoint)) 
         return 1;
     return 0;