You are not logged in.
I'm curious if anyone has tried this program yet? I'm wanna make sure its working for other people besides how it gains root accsess?
First thing ive ever made for anyone other than myself so am i definitly wondering if its working as it should?
Last edited by VanillaFunk (2013-07-13 00:54:20)
Offline
Just tried it and here are my observations.
comment1:
It fails to mount if the path to where the iso image is does not end with "/".
Why do you have two separate text files?One text field to add full path to the iso file should be doable
comment2:
It gives misleading pop up information when a user click to mount or unmount and then cancel the gtksu prompt.
I think you should check the status of gksu before processing because may cancel the dialog and your tool doesnt seem to account for this
comment3:
The tool just mounts the iso image at "/mnt" meaning it can not mount more that one image as they will all get mounted at the same path.
I think you should include the name of the iso image in the mount path
comment4:
Its better to use full paths to commands,not just command names forcing the system to start running around looking for them
comment5:
system() is not a good command to use.Use exe*() family of commands instead.
comment6:
your buffers are of fixed size.I think you should use strncat() instead of strcat() to make sure you dont everflow your buffers.
strncat() still has an issue as the concatenated string may not be NULL terminated,better command to use for string concatenation is snprintf()
comment7:
The tool doesnt check the return status of mount() and hence it reports success even when the command fail,possible reason for failure of the
absence of "/mnt" folder
comment8:
The tool doesnt check the return status of unmount() and hence it reports success even when the command fail,possible reason for failure is the
mount point being in use at the time the command was run
comment9:
It would be nice if you could add the ability to just drop an image file and have the GUI auto fill in the image path and name.
Or maybe add a button to show a file dialog box to allow a user to click through adding the image file to the tool.
Manually adding entries will get pretty old pretty fast.
I have a project that does what you are doing and you can know more about it from this page: https://bbs.archlinux.org/viewtopic.php?id=160477
Last edited by mhogomchungu (2013-07-14 03:15:01)
Offline
i got a lil time to work on this recently... i know its moving slow but as its my first project i have a lot im learning...
anyways... i did put out a new version that relays an error message if the mount command fails.
i will be setting up a config file for it the next time i put some update out it should be there ... the config file will hold the default directory to mount and also the default iso directory.
ive been having trouble getting it to read more than one character from a file in C and so its taking a lil while but i figured id at least address the error checking.
thanks for all the advice and ill implement as much of it as i can as i go. not sure i will get drag and drop working anytime soon but who knows![]()
also this is why i havent set it to mount to the folder /mnt/<nameofiso> i plan to have a couple folders that the config file manages so you may have more than one mounted ( i think six will be more than sufficiant) if not let me know
im still learnin the exe() family command once i get to that point ill plug that in as well and for the other things like strncat and sprintf i will do my best to implement those as well.
thank you
Offline
If you are stuck anywhere in your C code,feel free to ask me by sending me an email at mhogomchungu at GmaiL doT com. Hope you can decipher the email address.
Try to build without warnings,i build it here and it generated below warnings
[ink@mtz mounter2]$ make
gcc -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -Wall -g -c main.c
main.c: In function ‘mount’:
main.c:95:15: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
main.c:96:8: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
main.c:97:3: warning: implicit declaration of function ‘strcpy’ [-Wimplicit-function-declaration]
main.c:97:3: warning: incompatible implicit declaration of built-in function ‘strcpy’ [enabled by default]
main.c:98:3: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
main.c:98:3: warning: incompatible implicit declaration of built-in function ‘strcat’ [enabled by default]
main.c: In function ‘main’:
main.c:225:15: warning: unused variable ‘style1’ [-Wunused-variable]
gcc -o mounter2 main.o -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfreetype -lfontconfig
[ink@mtz mounter2]$
you can use or look for inspiration my abstractions[1] of fork/exe*() functionality you will need when you replace system().
[1] https://github.com/mhogomchungu/zuluCry … ty/process
With my implementation,your mount() function started like this:
static void mount ( GtkWidget *wid, GtkWidget *win)
{
int checkfail;
folderpathx = gtk_entry_get_text(GTK_ENTRY(textenter1));
isox = gtk_entry_get_text(GTK_ENTRY(textenter));
char path[ PATH_MAX ];
snprintf( path,PATH_MAX,"%s/%s",folderpathx,isox) ;process_t p = Process("/usr/bin/gksu");
ProcessSetArgumentList( p,"/bin/mount",path,"/mnt/",NULL );
ProcessStart(p);
checkfail = ProcessExitStatus(p);
ProcessDelete(&p);if (checkfail == 0)
{
Last edited by mhogomchungu (2013-11-04 00:37:48)
Offline
thank you much.
yes im still learning a lot in C at the momment so i appreciate the offer with help on code.
i will send you an email some time shortly![]()
cheers
Offline
ok so ive done some more work thanks for the help from all ![]()
mounter2 now has a file open button and you can select a file that way, as well as still being able to type out a file path manually.
instead of using system() it now uses execv(), and i did a little bit of work to slim down the errors that the compilier gives.
still have a lil work to do but at this point the application should now be operating much better.
i will do some more work to clean it up cosmeticly, as well as i do intend to some kind of alternate mount points in as i said earlier.
thank you all again
please use the mounter2-git aur build
ive been waiting for the aur - general to take mounter2 off of aur. but just so that you dont have an issue later mounter2 will hopefully be removed soon.
Offline
hello all, mounter2 no longer requires gksu as it now uses udevil and no longer needs a root password to mount. also since it uses udevil you may now mount several different images and none of them will take up your /mnt directory anymore.
im very pleased with this change.
also it no longer compiles with any warnings
yet again i appreciate the help i got with this project and glad to see it running stable.
hope you guys find it useful.
cheers
Offline