g_free (name);
g_snprintf (file, _POSIX_PATH_MAX, "%s", filename);
+ g_free (filename);
/* No need to check if the dir already exists or check
* mkdir() errors, because on any error the open() call will
int fd;
gpointer new_mem;
guchar *filename=_wapi_shm_file (type, segment);
+ int ret;
if(old_len>=new_len) {
return(mem);
return(NULL);
}
- if(write (fd, "", 1)==-1) {
+ do {
+ ret=write (fd, "", 1);
+ }
+ while (ret==-1 && errno==EINTR);
+
+ if(ret==-1) {
g_critical (G_GNUC_PRETTY_FUNCTION
": shared file [%s] write error: %s", filename,
g_strerror (errno));
return(NULL);
}
+
close (fd);
new_mem=_wapi_shm_file_map (type, segment, NULL, NULL);
int fd;
struct stat statbuf;
guint32 wanted_size = 0;
+ int ret;
if(created) {
*created=FALSE;
return(-1);
}
- if(write (fd, "", 1)==-1) {
+ do {
+ ret=write (fd, "", 1);
+ }
+ while (ret==-1 && errno==EINTR);
+
+ if(ret==-1) {
g_critical (G_GNUC_PRETTY_FUNCTION ": shared file [%s] write error: %s", filename, g_strerror (errno));
close (fd);
unlink (filename);
struct timespec sleepytime;
+ /* Something must have gone wrong, so delete the
+ * shared segments and try again.
+ */
+ _wapi_shm_destroy ();
+
munmap (*data, data_size);
munmap (*scratch, scratch_size);
if(closing_tries++ == 5) {
- /* Something must have gone wrong, so bail
- * out. This will let the calling code delete
- * the shared segments and try again.
- */
+ /* Still can't get going, so bail out */
g_warning ("The handle daemon is stuck closing");
return(FALSE);
}
/* Daemon didnt get going */
struct timespec sleepytime;
- if(data_created==TRUE) {
- _wapi_shm_destroy ();
- }
+ /* Something must have gone wrong, so delete the
+ * shared segments and try again.
+ */
+ _wapi_shm_destroy ();
/* Daemon didn't get going, give it a few ms and try
* again.
munmap (*scratch, scratch_size);
if(closing_tries++ == 5) {
- /* Something must have gone wrong, so bail
- * out. This will let the calling code delete
- * the shared segments and try again.
- */
+ /* Still can't get going, so bail out */
g_warning ("The handle daemon didnt start up properly");
return(FALSE);
}